Project-28 - A somewhat Minimal 6502 system
Re: Project-28 - A somewhat Minimal 6502 system
For reasons I do know know, I have never even thought of arranging the port outputs as a single row of pins. I usually end up with a pair of 2x6 headers...
Love the round corners!
Neil
Love the round corners!
Neil
Re: Project-28 - A somewhat Minimal 6502 system
barnacle wrote:
For reasons I do know know, I have never even thought of arranging the port outputs as a single row of pins. I usually end up with a pair of 2x6 headers...
Love the round corners!
Neil
Love the round corners!
Neil
I use Fritzing and it has round corners as a standard PCB option, but it's easy to upload your own design which I've done in the past.
And I know people will tell me to us something other than Fritzing, but it works for me and I've never had the time nor inclination to use e.g. KiCAD.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Project-28 - A somewhat Minimal 6502 system
BigEd wrote:
Really nice!
Here's a wee video of that GPIO test program running:
https://youtu.be/jmwvpzrQIlk
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Project-28 - A somewhat Minimal 6502 system
barnacle wrote:
For reasons I do know know, I have never even thought of arranging the port outputs as a single row of pins. I usually end up with a pair of 2x6 headers.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Project-28 - A somewhat Minimal 6502 system
Yeah, but I've never quite got the stage of actually using the pins with a wired connector...
Neil
Neil
Re: Project-28 - A somewhat Minimal 6502 system
After some more code wrangling, and currently at the expense of the DPOP command (for now...
I have added in code to enable "pins" 16 and 17 to be the CA2 and CB2 output pins.
Video test with 18 LEDs here:
https://www.youtube.com/shorts/pLJLw-KT6cI
Ugly code here:
-Gordon
Video test with 18 LEDs here:
https://www.youtube.com/shorts/pLJLw-KT6cI
Ugly code here:
Code: Select all
10 FOR P = 0 TO 17 : PM P,1 : NEXT P : REM All output
12 FOR P = 0 TO 17 : DW P,0 : NEXT P : REM All off
14 LED = 0
16 DO : UNTIL BTN
20 D = 1
90 DO
100 REM Outwards
110 FOR P = -3 TO 19
120 H = P+2 : T = P-1
140 GOSUB 800
160 NEXT P
300 REM Inwards
310 FOR P = 19 TO -3 STEP -1
320 H = P-2 : T = P+1
340 GOSUB 800
360 NEXT P
399 UNTIL BTN
400 END
799 REM Light the Head
800 IF H < 0 GOTO 820
805 IF H > 17 GOTO 820
810 DW H, 1
820 REM Extinguish the tail
830 IF T < 0 RETURN
840 IF T > 17 RETURN
850 DW T,0
860 RETURN
899 REM Small Delay
900 Z = D : DO : Z = Z -1 : UNTIL Z < 0 : RETURN--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
-
GlennSmith
- Posts: 162
- Joined: 26 Dec 2002
- Location: Occitanie, France
Re: Project-28 - A somewhat Minimal 6502 system
Really cool card, and a quite amazing feat to get all that squeeze!
Well done.
My native PLASMA compiler/assembler is nearing completion, soon I'll be working on the 'picocomputer' V2 board to add more I/O. Currently building a brand new office/laboratory - so I'm hacking bricks and timber at the moment...
Well done.
My native PLASMA compiler/assembler is nearing completion, soon I'll be working on the 'picocomputer' V2 board to add more I/O. Currently building a brand new office/laboratory - so I'm hacking bricks and timber at the moment...
Glenn-in-France
Re: Project-28 - A somewhat Minimal 6502 system
Musing idly about my this project with it's 4KB of ROM and I wondered if with todays technology if it would be possible to auto-create every possible program for it...
The short answer is no.
The long answer is that with 4096 bytes, or 32768 bits that's 2^32768 possible program combinations.
Or this number:
```
14154610310449547890015530277449516013481307114723881672343857482723\
66634240845253596025356476648415075475872961656126492389808579544737\
84888193829625087319174392779354491301105016265127795702984696021178\
32429335212075454134849698568518511412885151632014829953890550974606\
22098635675003353929224278582935664416262572773308153277514346480313\
37198861262948148356243817892895886777785007219831617484125195559099\
66720186450936408508036796302203672013838448667914492847375182628131\
23083439037243678440420897139923778278952770312318778329004894547065\
48907759683539601715360317005037130201476244387270111137955448430971\
86623068837760104753484414936004919434790412719929201953319830649301\
06164727241438940877685164658948654886171641124473975626241632750150\
12665536998102129357006604230548248604088316563586283572863704605835\
24037560857456912394738978919990859763452037046599671574272395358365\
07133656908815246080139195569461072006301590372954830738644391138016\
06534413113120760426405389744082890466204718323437754742728769194174\
15359465108829909044778631854737985283880604575689279436339239288726\
81927502029572963130840854853739937076881035646179383055483433876051\
40203761442474890296901815918651981105154536796710376718281970913547\
90191316833093307973744081973398315272390407159081122130951267707176\
06001288898889370710896248862361503869205214536908258196921765593065\
32539283633214259441113460347550936602814569030635060185929526129626\
33310186822763175677495345710587722355676795569202407891090705212539\
87131031263902293034744367356932509952188828475362311316445284228640\
48942180926373842363093124302491458786392813471918610416466060535600\
15919627786463782954136597707826469792362890626164424180715710392825\
51289348848274522893059561717860194034698241804887531275078109603637\
16049590757999536641963641702892757339167058079681852607422609501437\
51894385792160716775407660856056041061230366696674346777234726755644\
58991671268414100801031453917736665947284956674884035306621286465183\
79869385259980332461986518185624442207923368729450853640852108741887\
39084982027105970804744802498188580114909305185127137988036291016387\
16278578874145214429026186276602289012484526830076647356828764878327\
72671981642867890420794445689439318598309034704517688673232625391229\
76495244398804037014305667613803599255585227182019542875175873672475\
10777678934664472548647787048306330770862370015525858005479756471499\
22724490114280574976956418475321196722322621296416567885660489241698\
49150974229605341223334538769812792435657663917963116051492226283282\
55333061543877525846029404507128890053189442527544665141513571136187\
12687491460166975039248610050756844204683178063103254057407794427445\
42280876392417368185051637599103651319906329474629932045852181224319\
92323864244947394390438656356424037471932484452186545692102503479070\
59995382316519421101969676057526442680284830303180430573353222805018\
02860341751689188274606260422686582951407069150471890494925789966504\
94005882337071150004868956193406593184838633694068409823903437144417\
37603917423501105322884685142421795517290291865100361098410840265092\
93593963056343130470887251130390768119400901098555782859378291642135\
76612822210347957745947331047482525346602542653176899809278808232796\
55753183215024976925360066790226802966170014963286854195626611952804\
24865340147787798469817610331550072627301626759545202218873847103870\
51721829271917592295057169589539706361671082094809405871790468623234\
89591479646439001925916751377186483286903601564554219500845609861503\
83480284008030058019449571562827463795394702506037554653587862814760\
86044567893715130635914946085361612372742732638037372287633897118303\
25003635589775820956901024605156342910925586493824552455020058021827\
43148097380750227756512203741052272159062052927519186670604753285932\
25367793061070422108733800983855507591806413460964585595316359971179\
28428360473146866854548476138174759163973645341989644932348639703077\
63977612025904676375054733902222494567240932386825577627818395309382\
33751281999608711356147835655195236666056355678841889862284014674059\
05299517022071140444501276664220331459237171259487796834326521023279\
81350232991173181917703651238070867043818097596022601516129968969942\
94186084475619138121455294389585874237791634701296124550179672059485\
83825644584653059913766248084134437650398924463334501607088719812042\
14355757262371893121618180215480063895011823934417121420449530722640\
16676799011624620312246468554654371544717355227740157629086739710675\
84520999213334203514403896106589265339218287562293267006779843393489\
17095198778507942194914479881601719323310064956202800941494643794501\
53085406225081471879585894087916092141623752345112751067703166403681\
16233192029174084738895763231105334242615294732401162792222587853993\
50229746160627748391104890800941749728410681020066456774992937690913\
62853719300958775222088670909723895414866464400756314470281962034276\
53151254400972617464939993758173971811798241736098595825946848543658\
67336866597710306776646779054015223600418924819514541353605409174110\
98412286723830672712910603386748136348878056545746112142111116659985\
78239827562712244941430714074940488406075386370602428103148553866613\
33328355978175146163317281189821806288236576686680996217998420111580\
20767772792912298768785614574416019320546196793486018677884550715870\
60800498882997814896698077013688435322694985365454165583702949801703\
10859436604404660760194794351810454368978453510487884401022686777982\
57134774081674357195358847761226603653040273985441982221318087815835\
10731757121184121582560645334852109793641352029599826075104077870374\
03663098719991147174410691828257829962994116230874150089109413032841\
82131584799816210728034255555687956785287887098941927737599159824398\
52757342311772825283976891914501811799559794628226494652374169118085\
84411943733870989695301268340149236566278491290621891455728702122259\
09464530919531634090206371146321663797279805760028495288084848179380\
05393143560418251751660082393673791991597410359116763889887175401847\
01725892349893970518930285743652888903037802391946225382155322127355\
55299397542845350629361560347195459286729561168235383428930828378887\
67819759062411037226733875666841489952613848086674711483141468757969\
16360205860136356755590334886497210622441427879604040569613061760229\
81242840984825421797150393909713884990708008654327558025619074213270\
71425243151517163899450572014434750218584852812900005562970342269542\
50472095181775771285113154920596137223667246153439683573329241911780\
41956753132941596322101250417068813977303498033940613791099720174786\
77384469673403401026913955387821238710850815862283973359363491897561\
66133682438828083915092448068093378829653387015455046915895176504722\
39580754189547649790038026506707709763098148746524031013800531890876\
85822736050167616187466194643164792957255599296729855347115269347145\
24801198976081733367532601244525108153334164093570296332651726142036\
63326409976153102467083379129588112837280711111346490898947808402062\
40122896319416271165742299842926357927651541400097905374066273381663\
29815085351285184402580067823922888609038232074368207930418819070937\
91874917635829854808150640894907127600430185202301457398493533111918\
99410085375377195629343016256601136116316895346218801023181900021366\
97804478568712485643775845090858887978837475383091818107006150322255\
63091016689474780253412571338625581817921061549352557588323659562675\
65056353518614475443355653974709832264360954248612051291746370671305\
90642307629243536179720534925271191926581718513459577007725718419981\
76036269399889012480745075924980479390349332734102774400008120073461\
54054057105150697100390462348434476200512634590546589381789537792813\
95965499367201004900133759566058892007675966880659610760034720055858\
90222594655010430123127351665316862663484785966446263740624564875351\
64078092370300686810744079027168293604330487357964898997857175489884\
07891844801295704469910295047586163931064875233213125074540368086672\
10073602144290050619610614738139543285649346986393213102456863793665\
51253365593194179053761902060473060144318125066201968749171154736059\
71178569772408171100397371533552124547459077871311795786564705675350\
50192702347739653312290522505871612897990429961857550031033665725647\
98798275186840729473043731950533578242529032442799430837496080668443\
54164459078171071682983429451829855941112814994724957495016424180427\
34681158560450241309279063816746067016274795461832774699007774423895\
74867761539584849376567227195727866454634316160912681002825421465963\
36252239345089316917285840283423566693326354580799571478337895016968\
35781748234884919093574276330354577841975249603899105407104895787598\
26363067920662779643375404559740917650243886760053701687916991447475\
48400243119221696473883799528025238470801024392851125657516777263732\
01688403254466789070713575214256192452449029110040537994627424532403\
62017988005651872121910877137407363811871907321136729551437670859653\
72942045440999035907543716561786569601702176758321532681645916740045\
00239073743502648099105624548587493544825479270589742494495181223722\
32969334546863930699052311899564056704253136957713111315902738180807\
13469916045139064503982194263008992046624354925784856665539744927231\
73859777485412927016068341515517437115137050372750279278548332799193\
79940015416644280142731007653702011993607349522197479193975984616894\
20553973573482781780504410244900058938182569586653889712013229316805\
73846084525016332224646866617490832496084991690171583029352609836490\
90811346466834382998535159055294528437257397829548509795089307242351\
86059820854871544701550252690258540446464965724484952253430962618963\
78931482883286657508859228868487844184479087538453974144187004884366\
56125672340477219084758600854396134907113119170894329533766438418453\
27746615032459102574519235156077115597054781325560401976634149118851\
43697985464807309297002910250505302287769412337441199360424519160716\
55289088281679637829688164182798145303520723375206351878277849374382\
77081099134931629321824276272610462801682699580775411226681046337123\
77856
```
So not this year, at least.
-Gordon
The short answer is no.
The long answer is that with 4096 bytes, or 32768 bits that's 2^32768 possible program combinations.
Or this number:
```
14154610310449547890015530277449516013481307114723881672343857482723\
66634240845253596025356476648415075475872961656126492389808579544737\
84888193829625087319174392779354491301105016265127795702984696021178\
32429335212075454134849698568518511412885151632014829953890550974606\
22098635675003353929224278582935664416262572773308153277514346480313\
37198861262948148356243817892895886777785007219831617484125195559099\
66720186450936408508036796302203672013838448667914492847375182628131\
23083439037243678440420897139923778278952770312318778329004894547065\
48907759683539601715360317005037130201476244387270111137955448430971\
86623068837760104753484414936004919434790412719929201953319830649301\
06164727241438940877685164658948654886171641124473975626241632750150\
12665536998102129357006604230548248604088316563586283572863704605835\
24037560857456912394738978919990859763452037046599671574272395358365\
07133656908815246080139195569461072006301590372954830738644391138016\
06534413113120760426405389744082890466204718323437754742728769194174\
15359465108829909044778631854737985283880604575689279436339239288726\
81927502029572963130840854853739937076881035646179383055483433876051\
40203761442474890296901815918651981105154536796710376718281970913547\
90191316833093307973744081973398315272390407159081122130951267707176\
06001288898889370710896248862361503869205214536908258196921765593065\
32539283633214259441113460347550936602814569030635060185929526129626\
33310186822763175677495345710587722355676795569202407891090705212539\
87131031263902293034744367356932509952188828475362311316445284228640\
48942180926373842363093124302491458786392813471918610416466060535600\
15919627786463782954136597707826469792362890626164424180715710392825\
51289348848274522893059561717860194034698241804887531275078109603637\
16049590757999536641963641702892757339167058079681852607422609501437\
51894385792160716775407660856056041061230366696674346777234726755644\
58991671268414100801031453917736665947284956674884035306621286465183\
79869385259980332461986518185624442207923368729450853640852108741887\
39084982027105970804744802498188580114909305185127137988036291016387\
16278578874145214429026186276602289012484526830076647356828764878327\
72671981642867890420794445689439318598309034704517688673232625391229\
76495244398804037014305667613803599255585227182019542875175873672475\
10777678934664472548647787048306330770862370015525858005479756471499\
22724490114280574976956418475321196722322621296416567885660489241698\
49150974229605341223334538769812792435657663917963116051492226283282\
55333061543877525846029404507128890053189442527544665141513571136187\
12687491460166975039248610050756844204683178063103254057407794427445\
42280876392417368185051637599103651319906329474629932045852181224319\
92323864244947394390438656356424037471932484452186545692102503479070\
59995382316519421101969676057526442680284830303180430573353222805018\
02860341751689188274606260422686582951407069150471890494925789966504\
94005882337071150004868956193406593184838633694068409823903437144417\
37603917423501105322884685142421795517290291865100361098410840265092\
93593963056343130470887251130390768119400901098555782859378291642135\
76612822210347957745947331047482525346602542653176899809278808232796\
55753183215024976925360066790226802966170014963286854195626611952804\
24865340147787798469817610331550072627301626759545202218873847103870\
51721829271917592295057169589539706361671082094809405871790468623234\
89591479646439001925916751377186483286903601564554219500845609861503\
83480284008030058019449571562827463795394702506037554653587862814760\
86044567893715130635914946085361612372742732638037372287633897118303\
25003635589775820956901024605156342910925586493824552455020058021827\
43148097380750227756512203741052272159062052927519186670604753285932\
25367793061070422108733800983855507591806413460964585595316359971179\
28428360473146866854548476138174759163973645341989644932348639703077\
63977612025904676375054733902222494567240932386825577627818395309382\
33751281999608711356147835655195236666056355678841889862284014674059\
05299517022071140444501276664220331459237171259487796834326521023279\
81350232991173181917703651238070867043818097596022601516129968969942\
94186084475619138121455294389585874237791634701296124550179672059485\
83825644584653059913766248084134437650398924463334501607088719812042\
14355757262371893121618180215480063895011823934417121420449530722640\
16676799011624620312246468554654371544717355227740157629086739710675\
84520999213334203514403896106589265339218287562293267006779843393489\
17095198778507942194914479881601719323310064956202800941494643794501\
53085406225081471879585894087916092141623752345112751067703166403681\
16233192029174084738895763231105334242615294732401162792222587853993\
50229746160627748391104890800941749728410681020066456774992937690913\
62853719300958775222088670909723895414866464400756314470281962034276\
53151254400972617464939993758173971811798241736098595825946848543658\
67336866597710306776646779054015223600418924819514541353605409174110\
98412286723830672712910603386748136348878056545746112142111116659985\
78239827562712244941430714074940488406075386370602428103148553866613\
33328355978175146163317281189821806288236576686680996217998420111580\
20767772792912298768785614574416019320546196793486018677884550715870\
60800498882997814896698077013688435322694985365454165583702949801703\
10859436604404660760194794351810454368978453510487884401022686777982\
57134774081674357195358847761226603653040273985441982221318087815835\
10731757121184121582560645334852109793641352029599826075104077870374\
03663098719991147174410691828257829962994116230874150089109413032841\
82131584799816210728034255555687956785287887098941927737599159824398\
52757342311772825283976891914501811799559794628226494652374169118085\
84411943733870989695301268340149236566278491290621891455728702122259\
09464530919531634090206371146321663797279805760028495288084848179380\
05393143560418251751660082393673791991597410359116763889887175401847\
01725892349893970518930285743652888903037802391946225382155322127355\
55299397542845350629361560347195459286729561168235383428930828378887\
67819759062411037226733875666841489952613848086674711483141468757969\
16360205860136356755590334886497210622441427879604040569613061760229\
81242840984825421797150393909713884990708008654327558025619074213270\
71425243151517163899450572014434750218584852812900005562970342269542\
50472095181775771285113154920596137223667246153439683573329241911780\
41956753132941596322101250417068813977303498033940613791099720174786\
77384469673403401026913955387821238710850815862283973359363491897561\
66133682438828083915092448068093378829653387015455046915895176504722\
39580754189547649790038026506707709763098148746524031013800531890876\
85822736050167616187466194643164792957255599296729855347115269347145\
24801198976081733367532601244525108153334164093570296332651726142036\
63326409976153102467083379129588112837280711111346490898947808402062\
40122896319416271165742299842926357927651541400097905374066273381663\
29815085351285184402580067823922888609038232074368207930418819070937\
91874917635829854808150640894907127600430185202301457398493533111918\
99410085375377195629343016256601136116316895346218801023181900021366\
97804478568712485643775845090858887978837475383091818107006150322255\
63091016689474780253412571338625581817921061549352557588323659562675\
65056353518614475443355653974709832264360954248612051291746370671305\
90642307629243536179720534925271191926581718513459577007725718419981\
76036269399889012480745075924980479390349332734102774400008120073461\
54054057105150697100390462348434476200512634590546589381789537792813\
95965499367201004900133759566058892007675966880659610760034720055858\
90222594655010430123127351665316862663484785966446263740624564875351\
64078092370300686810744079027168293604330487357964898997857175489884\
07891844801295704469910295047586163931064875233213125074540368086672\
10073602144290050619610614738139543285649346986393213102456863793665\
51253365593194179053761902060473060144318125066201968749171154736059\
71178569772408171100397371533552124547459077871311795786564705675350\
50192702347739653312290522505871612897990429961857550031033665725647\
98798275186840729473043731950533578242529032442799430837496080668443\
54164459078171071682983429451829855941112814994724957495016424180427\
34681158560450241309279063816746067016274795461832774699007774423895\
74867761539584849376567227195727866454634316160912681002825421465963\
36252239345089316917285840283423566693326354580799571478337895016968\
35781748234884919093574276330354577841975249603899105407104895787598\
26363067920662779643375404559740917650243886760053701687916991447475\
48400243119221696473883799528025238470801024392851125657516777263732\
01688403254466789070713575214256192452449029110040537994627424532403\
62017988005651872121910877137407363811871907321136729551437670859653\
72942045440999035907543716561786569601702176758321532681645916740045\
00239073743502648099105624548587493544825479270589742494495181223722\
32969334546863930699052311899564056704253136957713111315902738180807\
13469916045139064503982194263008992046624354925784856665539744927231\
73859777485412927016068341515517437115137050372750279278548332799193\
79940015416644280142731007653702011993607349522197479193975984616894\
20553973573482781780504410244900058938182569586653889712013229316805\
73846084525016332224646866617490832496084991690171583029352609836490\
90811346466834382998535159055294528437257397829548509795089307242351\
86059820854871544701550252690258540446464965724484952253430962618963\
78931482883286657508859228868487844184479087538453974144187004884366\
56125672340477219084758600854396134907113119170894329533766438418453\
27746615032459102574519235156077115597054781325560401976634149118851\
43697985464807309297002910250505302287769412337441199360424519160716\
55289088281679637829688164182798145303520723375206351878277849374382\
77081099134931629321824276272610462801682699580775411226681046337123\
77856
```
So not this year, at least.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Project-28 - A somewhat Minimal 6502 system
I do hope you did that calculation on some flavour of 65xx!
Re: Project-28 - A somewhat Minimal 6502 system
There's a question... is it possible to do that calculation on a 6502 with only 4K of RAM (and no other storage)?
Re: Project-28 - A somewhat Minimal 6502 system
BigEd wrote:
I do hope you did that calculation on some flavour of 65xx!
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Project-28 - A somewhat Minimal 6502 system
John West wrote:
There's a question... is it possible to do that calculation on a 6502 with only 4K of RAM (and no other storage)?
All you need is time..
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Project-28 - A somewhat Minimal 6502 system
Mmm, yes, calculating 2^32k as a decimal with only 32k bits... we're one bit short before we even start! The carry bit might be brought into play...
But the very first step (in one approach) is to divide by 10, which knocks three bits off. Still a bit tight, with no stack and no zero page to spare!
We have lots of program space though. So we could proceed by dividing by a million, for example, which would free up two bytes. Hmm... and in any case this gives us the digits in reverse order, which is all a bit backwards.
I'm beginning to think this is going to be quite a squeeze! I withdraw the question, m'lud!
But the very first step (in one approach) is to divide by 10, which knocks three bits off. Still a bit tight, with no stack and no zero page to spare!
We have lots of program space though. So we could proceed by dividing by a million, for example, which would free up two bytes. Hmm... and in any case this gives us the digits in reverse order, which is all a bit backwards.
I'm beginning to think this is going to be quite a squeeze! I withdraw the question, m'lud!
Re: Project-28 - A somewhat Minimal 6502 system
Life in the Slow Lane...
Doing more testing and writing some code for my Project-28 system, another mention in another place about a "tiny" Life got me thinking of writing one in my TinyBasic on the Project-28 board...
There is nothing special about my implementation, however it's split over two programs. One to let you enter the initial pattern (No fancy editor here!) and one to run the game. It's not fast, but it was never going to be. It was also a good test of using an array (*cough*) or direct memory peek/poke via the indirection operators.
It needs 2 programs as the grid array at 40x25 needs 1000 bytes of RAM and a naive approach uses 2 arrays, so almost 2KB needed - out of the 3.5KB we have, that makes it very tight - especially as I used a particularly simple, but perhaps 'dumb' way to get the initial pattern in-place...
The setup code is:
Note that it may at first appear a bit odd - there are REM statements with no line numbers - that's for a couple of reasons, but mostly to save space in the program - I am using an external editor to create this then I send the file to the Project-28 SBC over the serial line. This was a trick used in early TinyBasic systems where you might edit a paper tape with the 'source' externally then feed it into the system to run it.
Also; as the serial is bit-banged software then it's effectively half duplex, so I have a command (Press Ctrl-O) that disables all output which allows it to take 'keyboard' input at full speed (9600 baud). Another Ctrl-O enables output again. It's a bit fiddly but has proven to be very effective
(oops.. more editing as I hit submit rather than preview!)
so this pokes the data into RAM at a known fixed location near the top of usable memory so that when the Life program loads and runs it's not overwritten.
This is the actual Life code:
It's not fast and it never was going to be. It's taking about 57 seconds per generation, so from this:
To this, 80 generations later:
Was just over an hour.
Lots of fun!
-Gordon
Doing more testing and writing some code for my Project-28 system, another mention in another place about a "tiny" Life got me thinking of writing one in my TinyBasic on the Project-28 board...
There is nothing special about my implementation, however it's split over two programs. One to let you enter the initial pattern (No fancy editor here!) and one to run the game. It's not fast, but it was never going to be. It was also a good test of using an array (*cough*) or direct memory peek/poke via the indirection operators.
It needs 2 programs as the grid array at 40x25 needs 1000 bytes of RAM and a naive approach uses 2 arrays, so almost 2KB needed - out of the 3.5KB we have, that makes it very tight - especially as I used a particularly simple, but perhaps 'dumb' way to get the initial pattern in-place...
The setup code is:
Code: Select all
NEW
0REM Game of Life: Setup
1GOTO100
REM - Store data into RAM - 0,0 is top left.
REM Code at the top to try to make a tiny bit of speed increase
2J=(24-L)*40+X:PR"+";:FOR I = 0 TO 39:?(J+I)=?(A+I):NEXTI:L=L+1:RETURN
REM Main code is here
100GOSUB 800
110GOSUB 900
120PR "" : PRINT "Setup Complete." : VDU 7
130REM CH 7
140END
REM Initialise Variables
800A = TOP
810X = &C00
820Y = &800
830FOR I = 0 TO 25:VDU 32:NEXT I:VDU93,13,91
835Z=2:L=0
840RETURN
REM =================================================================
REM === Edit Below, each line must be exactly 40 characters and
REM === we have 25 lines; 0-24.
REM === Note that we MUST leave the top, bottom and side
REM === edges of the grid clear. This simplifies the otherwise
REM === very slow processing...
REM =================================================================
REM 0 1 2 3 3
REM 0123456789012345678901234567890123456789
900$A=" " : GOSUB Z
901$A=" * ** " : GOSUB Z
902$A=" * ** " : GOSUB Z
903$A=" *** " : GOSUB Z
904$A=" " : GOSUB Z
905$A=" * * " : GOSUB Z
906$A=" * " : GOSUB Z
907$A=" * " : GOSUB Z
908$A=" " : GOSUB Z
909$A=" " : GOSUB Z
910$A=" " : GOSUB Z
911$A=" " : GOSUB Z
912$A=" " : GOSUB Z
913$A=" " : GOSUB Z
914$A=" " : GOSUB Z
915$A=" " : GOSUB Z
916$A=" " : GOSUB Z
917$A=" " : GOSUB Z
918$A=" " : GOSUB Z
919$A=" " : GOSUB Z
920$A=" " : GOSUB Z
921$A=" " : GOSUB Z
922$A=" " : GOSUB Z
923$A=" " : GOSUB Z
924$A=" " : GOSUB Z
REM =================================================================
REM === END OF USER EDITABLE DATA
REM =================================================================
925RETURNAlso; as the serial is bit-banged software then it's effectively half duplex, so I have a command (Press Ctrl-O) that disables all output which allows it to take 'keyboard' input at full speed (9600 baud). Another Ctrl-O enables output again. It's a bit fiddly but has proven to be very effective
(oops.. more editing as I hit submit rather than preview!)
so this pokes the data into RAM at a known fixed location near the top of usable memory so that when the Life program loads and runs it's not overwritten.
This is the actual Life code:
Code: Select all
NEW
0REM Game of Life
1GOTO100
REM Store status into new grid
5REM?D=Q:VDUQ:RETURN
5?D=Q:RETURN
REM Check the 8 cells surrounding cell at Line N and Column C
REM S is our test cell address
REM D is our new cell address (Destination)
REM Q is the value to store
REM K is the surrounding cell count
10S=N+C : D=P+C : Q=32 : K=0
11IF?(S-1)<> Q K=K+1
12IF?(S+1)<> Q K=K+1
13IF?(S-39)<> Q K=K+1
14IF?(S-40)<> Q K=K+1
15IF?(S-41)<> Q K=K+1
16IF?(S+39)<> Q K=K+1
17IF?(S+40)<> Q K=K+1
19IF?(S+41)<> Q K=K+1
REM 0 or 1 neighbour - die
20IF (K=0) OR (K=1) GOTO 5
REM 2 neighbours to a live cell? Lives on...
25IF (K=2) AND (?S=42) Q=42:GOTO 5
REM 3 neighbours? If live then lives on, if no life, then create
30IF (K=3) Q=42:GOTO 5
REM 4,5,6,7 or 8 neighbours - die
35GOTO 5
REM Horizontal Line
40PR "+";:FOR I = 1 TO 38:PR "-";:NEXT I:PR "+":RETURN
REM Start here
REM =========================================
100GOSUB 900
REM We avoid the outer edge on all sides
REM N is the current Row start
REM P is the new Row start
110DO
120 FOR I = 0 TO 25:VDU 32:NEXT I:VDU93,13,91
130 FOR L = 1 TO 23
140 PR "+"; : N = (24-L)*40+F : P = (24-L)*40+T
150 FOR C = 1 TO 38:GOSUB 10:NEXT C
160 NEXT L
170 A=F:F=T:T=A
175 VDU13
180 G=F: GOSUB 700
190 PRINT "Generation: ",Z : Z=Z+1
200UNTIL BTN
299END
REM Print current grid
REM G: Start address of current grid
700REMN = G + (24*40)
710GOSUB 40
720FOR L = 1 TO 23
730 PR "|"; : N = (24-L)*40+G
740 FOR C = 1 TO 38 : VDU ?(N+C) : NEXT C
750 PR "|"
760NEXT L
770GOSUB 40
780RETURN
REM Initialise Variables
900PR "Initialising... ";
905A = TOP
910X = &C00
920Y = &800
REM From & To
932F=X : T = Y : Z = 1 : REM From and To, Generation
REM Wipe destination grid
930D = Y
933FOR L = 0 TO 24
934FOR C = 0 TO 39
940?(D+C)=32
950NEXT C : D = D + 40 : NEXT L
960PR ""
970PR "From:" : G=X : GOSUB 700
980PR "To:" : G=Y : GOSUB 700
985I=GET
990RETURNCode: Select all
+--------------------------------------+
| * ** |
| * ** |
| *** |
| |
| * * |
| * |
| * |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+--------------------------------------+Code: Select all
+--------------------------------------+
| ** |
| ** |
| |
| |
| * |
| * |
| * |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| * |
| * |
| *** |
+--------------------------------------+
Generation: 80Lots of fun!
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Project-28 - A somewhat Minimal 6502 system
Nice to see that Mr Conway hasn't been forgotten, Gordon!
I don't think I can do that on mine; no peek or poke. But let's see how much memory is left...
Neil
I don't think I can do that on mine; no peek or poke. But let's see how much memory is left...
Neil