Soinsteadofdoingallthiswillgetridofthatandsay, J s r l c, theinstructionandthesamethinghereisanotherinstructionswouldgetridofallthat, andatanotherjumptosubroutineLCDinstruction.
Wecanreplaceallofthiswithjust a jumpsubroutinefrankcharacter, and I'llgoaheadanddothatforeachletterintheentiremessage.
Andyoucanseethisisgoingtosignificantlyreducetheamountofcodeweneedtosendeachletter, sincemostofthecodewestartedwithwasjustrepeatingthesamecommandstosend a lettertothedisplay.
Andnowthat's beenfactoredoutintothatsuburb.
Nowthisiswhatwe'releftwith, andit's sayingit's a lotshorterandalso, I think a lotmoreclearaboutwhatitdoes.
Andthethingwithassemblylanguageisthere's a directcorrelationbetweentheassemblycodethatyou'rerightandthemachinecodethatruns.
Youcanseethere's a fairamountofitnowfromtheassembleronourmodifiedcode.
Now, ifwelookatthenewcodethatwegenerated, see, thisis a is a lotshorter.
Thatmeansisalsogonnatakeup a lotlessroomintherumorwhereverwe'rerunningitfromnow, they're I guessthereis a tradeoffinthesensethatjumpingtoandreturningfromthesubroutineswilltake a fewextraclockcyclestoexecute.
I coverallthisinthefirstfewvideosifyouwanttogobackandwatchthat, butatanyrate, atthispointwhereitaddress 8000 andwe'rereading a nine, whichisthefirstload a instructionbecause a nineistheopcodeforlowday.
Andsothat's a store A 6002 That's thisstore a D D.
R B isthatonthenextclockcycle, weseeitwritingthatFFtoaddress 6002 Ifwekeepgoing, wegetload A e zeroandthenstore, eh?
6003 Suchthestory, DDR A Andnowwecanseeitwritingthat e zerotoaddresssixyearsorthreethenextwegetLoad a 38 andthat's ourfirstinstructionthatwewanttosendtotheLCD.
Well, let's let's actuallykeepgoing a couplemoresteps.
If I goonemorestep, itactuallyseemslikeit's maybebackontrackhere, right?
Becausewehad 800 See, it's readingtheopcodeforthejumptosubroutinethan 800 D.
It's readingfive D andthen 800 e eventually.
Afterallthisweirdness, it's reading a zero, andthatpartseemsrightbecause I have a jumpsubroutineAndthen, ifyoulookatthisfive d andthis 80 that's theaddressit's jumpingto.
SoSowe'rereallywhattheprocessisdoingisit's taking a coupleextraclockcyclesheretosavethataddresssothatwecanreturnbacktoit.
Andsoit's it's iswritingthis 800 e somewhereinmemorysothatwecouldgetbacktoit.
Solet's keepsteppingthroughthecodehere.
Sothispointwe'reinthesubroutines.
Weread a story a sixyear 00 whichisPort B andweseeitright?
Theinstructionswhoaddresssixyear 00 Wehave a load, a zeroand a storysixyearsoronewhichispoured a.
Andthere's thezerobeingwrittentosixyearsago.
One.
Wehavelowday 80 whichistheenablebitand a storytosixyearsoroneagaintosettheenablebit.
Andtheregoesweseethetopitheregettingsettoaddresssixyearsorone, then a load a zeroagainandanotherstore a sixyear 01 Andthereweseethezerogoingouttosixyearsoroneagain, clearingthatenablebit.
So I'm gonnagoaheadanddeletebothoftheselinesbecausetheydoadd a coupleextraclockcyclestotheprogramandyouknow, there's justnoneedifwepush a ontothestackanddon't pullitoffbeforethereturnhere.
Thatwouldbebad, becauseinsteadofreturningtothecorrectaddress, youknow, 800 e Ifthestackpointersoffbecausewedidn't pull a topvalueoffthestack, thenthereturninstructionwouldthinkweneedtoreturntozero e 38 Sowewouldendupjumpingtosomeotherrandommemoryaddress, youknow, 03 e 38 orwhatever.