I'm intheprocessofbuilding a basiccomputerusing a versionofthe 65 02 microprocessor, andsofar I'vejustprogrammedittoblinksandledislikethisandtheprogram I wrotethat's doingthisisstoredonthisRamchip.
Really, it's a programmableramchips.
Wecanactuallychangetheprogram, butifwepullthechipout, wecouldputitin a programmerandtake a lookatwhat's onit.
Sothisisan 80 28 c 2 56 chip.
Sowejustgotoreadhereandreadthedevice.
Here's theprogramthatwasrunning.
Itwasjust a bunchofhexdecimalnumbers.
Butofcoursetheyhavemeetingso a ninemeanstoloadthenextbiteintotheregister.
SothisisgonnaloadFFintotheregister.
A.
D meanstostorethecontentsofthe A registerintotheaddressinthenexttwobiteshereandsoonuntilwegettothispoor C 0580 whichobviouslymeanstoeloopbackandkeeprepeatingthisWell, ifthatdoesn't seemsoobvioustoyou, thenyou'renotgonnabesurprisedtohearthatnooneactuallywritesoftwarethisway, evenforhere, reallylowlevelstufflikethis.
Now, mylastvideoactuallydidwritethisprogrambywritingoutthemachinecodeherebyhandherewith a littlebitofpipeconchodownheretosortofmassageitinto a binaryfileoftheappropriatesize.
Butthisisjust a textfileyetwecan't putthisonthepromdirectlylikethis, youknow, weneedweneed a binaryfile.
Butifwegotake a lookatthedocumentationfortheassembler, youcanseethere's, ah, bunchofoptions.
Andoneofthoseoptionsisdash F formattouse a particularoutputformat, anditsays, seethechapteronupperdriversformoredetails.
Butifwetake a lookatThea, let's see, there's anoutputmodulehereforsimplebinaries.
Let's take a lookatthatAndhereitsaysthesimplebinaryoutputmodulecouldbeselectedwiththedash f Beenoption.
Solet's dothat.
Soruntheassembleragainwiththedash f Beenandherfamily.
Nowifwelookat a doubtoutwell, nowitjustlookslike a coupleunknowncharacters.
I guessthisisThisisthecontentsofthefile, whichissortofwhatweexpect, right?
It's just a binaryfilewith a coupleinstructionsinit.
Let's do a hexdumptoseeexactlywhat's inthere.
Andherewego.
We'vegotourprogram.
A nineistheoutpopcodeforLoad A F F.
Andthen a D istheopcodefor a story.
Andthenit's gotthe 6002 here.
Andsothatmatchestheprogramthatwewrote.
A couplethings I'llpointouthereintheprogrambefore I gettoofarisyousee, there's a hashsymbolhere, andthenthedollarsignsandthesehavemeaningtotheassembler.
Soif I leftoffthisdollarsignandthiswouldbeaddress 6002 decimalNotaddress 6002 Hexidecimal, whichiswhatwewant.
Andthenthatthehashsignupheremeansthatthisload A is a loadimmediatemeaningIt's loadingthevalueFFintothe A register.
Andif I leftoffthishashsymbol, thenthiswouldactuallymeantoloadwhateverdataisataddress F f orreallyaddress 00 ffloadloadwhatever's atthatmemoryaddressinto a register.
So I actuallyletmeleavethehashsymboloffandsavethisandshowyouwhatthatdoes.
So I gobackinandjustreruntheassemblerandtake a lookatthehexdumpyoucanseeinsteadofhavingyouknowthisinstructionbeing a nine f f.
It's nowinstruction a fiveFF.
Soit's actually a differentupcode, eventhoughtheonlythingwechangedwasjustleadingleadingoffthishashsymbol, itwashereisthatgettingridofthathashsymbolactuallychangestheupcode.
Sowelookatthedatasheetforthemicroprocessor.
Wecansee a fiveisstillinupcodefortheload.
A instructionjustlike a nine.
Butwhere a nineiscoveredunderthisgofigureit a hashcolumnherethatmeansthemimmediatedata.
A fiveis E P, whichiszeropage, whichmeansit's loadingfromanaddressthatstartswith 00 inthiscasewouldbe 00 FF, whichisverydifferentfromwhatwewant.
TheEECproblemthatwe'reusingisalsoattheendhereitat F f F C well, wellseven F f c and F seven f f d Inthewrong, whichisgoingtoappearataddress F f f, C and F f, f T andmemory.
Thisistheresetvector.
Andyouknow, the 0080 iswhattellstheprocessorwheretostartexecutingcode.
Butnowwecandoanotherordirectivedownhereatthebottomforaddress F F F C, whichsaysthatthenextthingafterthisgoesataddress F f F C sorighthereafterthatordirectIfwewanttojusttelltheassembler, justputtheaddress 8000 Becausethat's thestartaddresswewannahaveatthis F F F C position.
Andwecoulddothatwiththedotworddirectivewasjustputs a wordwhichisjust a 16 bitvalueintothetheoutput.
Soitis a wordhate 000 Soifwesavethisandassemblethislips, assembleit, um, getsomeerrorshere.
Andthat's verymuchintentionalbecausethat's howtheassemblerknowsthatit's a labelnow.
Ifwewant, wecanaddanotherlabelatthetopherefortheinitializationcodeandthendownhereatthebottomfor a resetvectorinsteadofhardcoatingthatwecanjustusethatresetlabel.
Let's savethisandassembleitagain, andwetake a lookattheoutputyoucouldsee.
It's thesameasbefore, sothatjumpthatfor C 0580 isthesame.
Someledisreallystillbeeasierforustowriteprogramsthatare a littlebitmorecomplex.
Nottosaythatblinkingeh, ladiescanbefun, Butinthenextvideo, I'm gonnahookthescontrolsignalsuptothisLCDdisplay, andwe'llbeabletowrite a programlittlebitmoreeasilytocontrolitandactuallydisplaysomemoreinterestingtext.
AndrememberIfyouwanttofollowalongwiththesevideosandbuildandprogramyourownlittlecomputer, I havegatheredallthepartstogetherthatyou'llneedemandyoucouldbuyhimon.
Mywebsiteisas a kitcomeswitheverythingyouneedtobuildthebasiccomputer, and I alsogot a kitfortheclockthat I'm usinghereiswell, soyoucancheckouteaterdotnetslash 65 02 formoreinformationonallofthatand, asalways, thankstoallmypatron, sinceyoursupportisalsocriticalinmakingthesevideospossible.
I'm intheprocessofbuilding a basiccomputerusing a versionofthe 65 02 microprocessor, andsofar I'vejustprogrammedittoblinksandledislikethisandtheprogram I wrotethat's doingthisisstoredonthisRamchip.