/
LyonsSerraScienceUniversityVictoriaARMSimrunningWindowsenvironment LyonsSerraScienceUniversityVictoriaARMSimrunningWindowsenvironment

LyonsSerraScienceUniversityVictoriaARMSimrunningWindowsenvironment - PDF document

jocelyn
jocelyn . @jocelyn
Follow
343 views
Uploaded On 2022-08-16

LyonsSerraScienceUniversityVictoriaARMSimrunningWindowsenvironment - PPT Presentation

LastupdatedARMSim191 ARMSimUser TableContents1Overview ID: 936398

clear seg draw line seg clear line draw swiswi key file armsim button asciz movr0 user print equswi display

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "LyonsSerraScienceUniversityVictoriaARMSi..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Lyons,SerraScience,UniversityVictoriaARMSim#runningWindowsenvironment. LastupdatedARMSim#.191 ARMSim#User TableContents1.Overview................................................................................................................................................................12.Features...................................................................................................................................................................32.1Toolbar.......................................................................................................................................................32.2Views.........................................................................................................................................................33.SettingtheSimulator.....................................................................................................................................

63.1DockingWindows...................................................................................................................................63.2BoardView:SWIinstructions...........................................................73.3Fonts..........................................................................................................................................................73.4Colours......................................................................................................................................................74.GettingStarted......................................................................................................................................................74.1CreatingFile..........................................................................................................................................74.2OpeningFile.............................................

......................................................................74.3RunningProgram.................................................................................................................................84.4StoppingProgram................................................................................................................................84.5CodeView................................................................................................................................................84.6RegistersView..........................................................................................................................................95.DebuggingProgram........................................................................................................................................105.1SteppingProgram............................................................................................

..................105.2RestartingProgram............................................................................................................................105.3ReloadingProgram............................................................................................................................105.4OpeningMultipleFiles.........................................................................................................................15.5Breakpoints.............................................................................................................................................116.AdditionalViews................................................................................................................................................126.1WatchView.............................................................................................................................................126.2MemoryVi

ew.........................................................................................................................................136.3OutputView...........................................................................................................................................156.4StackView..............................................................................................................................................166.5CacheViews...........................................................................................................................................177.SomeARMSim#Limitations............................................................................................................................198.SWICodesARMSim#:firstPlugin.......................................................................................208.1BasicSWII/O.......................................................

........................................................208.1.1Detailed Descriptions and Examples for SWI Codes for I/O....................................................219.SWIOperationsOtherPlugthePlugIn................................................................259.1DetailsSWIEmbestPlugin.............................................2710.CombiningandCode..........................................................................................................................310.1CompilingProgramARM............................................................................................3110.2CompilingProgramSourcery....................................................................3210.3LinkingProgramARMSim#...........................................................................3310.4ARMParameterPassingConventions................................................................................................3310.5Exa

mpleARM...............................................................................................3411.CodeExamples....................................................................................................................................................3411.1Example:PrintStrings,CharactersStdoutSWIInstructionsI/O.......3411.2Example:Openfiles,integersSWII/O............3611.3Example:UsefulusingSWIPlugIn...............................................3711.4Example:Subroutinewaittimer.........................................38 UserGuide 11.5Example:Subroutineintervalwithtimer(EmbestBoard).....................3811.6Example:SWIPlug(EmbestView)...................................39 ARMSim#User FeaturesARMSim#toolbarandgiveaccessvarietyandmonitorassemblylanguagesectionscontrolstheandtheinformationdisplayedtheviews.ToolbarViewsARMSim#simulator’sandcontentsthesystem’sstorage.ARMSim#severalviews,shownFigureandsummarizedTableAl

lenabledViewmenuabovetoolbar.views,excepttheViewwindowsFigureandmovementbelow.ARMSim#toolbareasymanythethesimulator,especiallyfeaturesallowcontrolexecutionaresummarizedTableTableToolbarTheStepbuttonsimulatorexecuteinstructionandmovenextinstructioncallinstruction)nextinstructioninstructionsubroutine.TheStepOversimulatorexecutethehighlightedandmovenextthecurrentsubroutine.instructioncallthentheuntilthereturns.unlessbreakpointencountered,willthethecall.TheStopcausesexecutionThesimulatorruntheencountersbreakpoint,0x11execution),runtimeerror.TheRestartsimulatorstarttheexecutionTheReloadcausesloadnewversionfromharddriveandstartexecutionthethebeginning. UserGuide Views ARMSim#User TableViewsViewassemblylanguagetherentlyalwaysvisibleandclosed.RegistersViewtheuserregistersavailableprocessor,wellthestatustheandtheconditionflags.Theregistersdisplayedhexadecimal,unsignedsigneddecimalthecontentsVectorPointdisplayed.TheyincludetheoverlappedPr

ecisions31)andPointRegistersOutputView:Consoleanyautomaticandmessagestheulator.OutputView:Stdin/Stdout/StderranytextstandardViewdisplayssystemstack.view,wordstackhighlighted.WatchViewvaluesvariablestheuserhaswatchlist,thelistvariablesthewishesmonitortheViewsthecanandinstructioncache,displayedViewseparateinstructiondisplayedCacheandInstructionViewsrespectively,selecteduser.ControlsViewanyins.wereapplicationstart,viewdisabled.Viewmemory,bit,bit,bitwords.canmultipleviews,eachmemory. UserGuide SettingSimulatorappearanceARMSim#,includingthelocation,andcolourviews,customizedsuittheuser’ssimulatorclosed,thesettingsnexttimethestartsARMSim#.sectionscustomizeARMSim#’sappearance.WindowsAlltheCodeView2).anysidewindow,aboveapplicationwindow.tion,displayedhidden,displayedhashidemovedockingwindow,clicktitlethewindow,andthedesiredtion.viewshavestackedsinglewindow,theviewnamethetabswindow,clickandlocation.windowbetweentheandhidestates,thenameVie

wmenu.Alternatively,currentlydisplayed,clicktherightthewindow.windowbetweentheshowandautomodes,clickthetherightcorner. Windows viewfromviews pintheandautohidemodes,andhideview Window Windowhide FloatingWindow ARMSim#User View:ARMSim#usedcompletelyandI/Oextremelyhaveenabledexplicitlyeveninstalledsameareconfigurableextrafunctionality,normallygraphicalviewboardandlights).veryextensionSWII/Ofunctionalities,readingandwritingstandardinbelow).theseclickandPreferencesandthenPluginsTheavailablemodulesARMSim#arelistedandneedcheckedenabling.changethesize,style,colourtheview,movecursorview,clickrightmouseandselectcontextmenu.Then,makechangesdialogclicksettings,movethecursorview,clickbutton,andRestoremenu.Restoreandcolours.colourview,movethecursorintotheview,clickrightmouseandselectBackgroundColour)menu.makethechangesbox,andclickrestoreandmovethecursorintotheview,clickrightmouseandRestorethemenu.willrestorefontsettings.usecontext.andViewsuse

dcolourtheRegisterandViewstextstoragelocationshavewrittenARMSim#simulateARMinvolvestwoactuallyrunningandtheinformationningsimulator,4.5andtwoavailablethesimulator.ARMSim#bothassemblysourcethattheAssemblersyntaxandthewithCygwinCodeSourcery.assemblysourcecancreatedusinganytextTextPad)andsavedextension.ARMassemblysourceandmustcompiledaccordingandassemblymingthereferences.Fileselectnavigateandclickthesourcethesuccessful,thecontentsappearthe UserGuide Viewwith_startsubroutinehighlighted.ViewinstructionnotmustcheckOutputViewcompiler6.3).Notes:•The(.s)•Ifnotthelistingmakesurethathas•ThecannotViewwindow,changedtextandthenRunningrundisplayedtheCodeViewclicktheContinuebuttontheTableTherunssimulatorencountersbreakpointexplanationbreakpoints)0x11instructionexecution),error.thatcurrentlyrunning,clickStoptheTableWhenhasanystoragelocationstheRegisterCacheandViewsthathavewrittenstartedrunninghighlighted.ViewViewdisplaystheassemblyinstructionsth

atcurrentlyactive.instruction,simulatorshowsmemoryaddressinstructionandthebinaryresentationseparatedcolonanddisplayedhexadecimal View thefiledisplayedView Theinstructionexecuted addressinstruction(displayedform) Thebinaryrepresentationinstruction(displayedform) ARMSim#User andsuccessfullyassembledlinked,itsaredisplayedViewabove,andexecutedhighlighted.multiple5.4),theexecutionstartdisplayedViewinstructionviewedclickingViewViewViewdisplaystheavailableARMprocessor,wellthestatustheCurrentandtheconditionleftmostbitstheCPSR,displayedsimulator).Additionally,VectorPointavailablethelabelled“FloatPoint”.registerstheSingleregistersPrecisionterstheVFP.Notethattwosetsregistersoverlapped.PurposeRegistersclickingPurposeRegisters”theView.contentsregistersdisplayedhexadecimal,signedunsignedHexadecimalSignedandUnsignedRegistersViewswitchbetweenFigureinstructionexecutedcommands5.1)sequenceexecutedthebutton4.3),anyandconditionthatwereareexecutionin

struction(s)has Use these buttons to switch between the Hexadecimal, Unsigned Decimal and Signed Decimal display modes. Registers that were written to during the execution of the last instruction (or sequence of instructions) Condition Code Flags CPSR (Current Program Status Register) GeneralView. alsoTable 3. slstacklimitfpframepointeripintracallspstacklrlinkpcprogram buttonsHexadecimal,andSignedDecimaldisplaymodes Registerswrittenduringexecutionlastinstruction(orinstruc ConditionFlags (CurrentProgramStatus UserGuide PointareselectedclickingthePoint”View.PointRegistersviewedPrecisionDoublePrecisionregisters.UsethePrecisiontabsthetheRegistersViewswitchbetweenARMSim#numberusersassemblyprograms,includstepandReloadandOpenMultipleandbreakpoints.5.1andexecutioncontrols.andandOpenMultiplerespectively,andmanagethroughtime,Overthetoolbar,alternatively,selectOverhasexecutedusingOvertheexecutedandmemorylocationstheCacheViewswerewrittenex

ecutioninstructionhighlighted.mostinstructions,resultsbothOverhowever,whenbranchsubroutine,executesthebranchandmovesthesubroutine.contrast,Overexecutessubroutineandmovesinstructionthebranchoriginalsubroutine.consistsmultipleandtherebranchsubroutineanotherexecutingthebranchthedisplayedViewRestartingclickthebuttontoolbar,selectRestartingregisters,andmemory;setstheprogramaddressandnextinstructionexecuted).Reloadingclickthethetoolbar,copyharddrive;theregisters,memory,stack,andwatches;setsaddressandnextinstructionexecuted).multipleOpenclickbox;navigatethefolder,theandclickthreesentenceuntilhavethetheclickthehavebeensuccessfullythecontains_startmain)subroutineViewtheinstructionthissubroutinehighlighted.removelistopened,selectbox,andclickRemoveremovelistclicktheClear ARMSim#User Notes:•ThemustassemblerARMnationandfiles.•Iflistingthathasselected.•IftheViewinstructionhighlighted,checkOutputViewerrorssection6.3).•Whentheassembledsourceand

Breakpointsbreakpointuser0x11instruction,executionshouldterminate).beingareusedhaltexecutionthecontentsstoragesuchregistersandmainmemory,examinedensurethatworkingcorrectly. Use these buttons to switch between the Single or Double precision Floating Point registers Registers that were written to during the execution of the last instruction (or sequence of instructions) Condition Code Flags FCPSR (Floating Point Current Program Status Register) RegistersView. Flags switchtheSingleDoubleFloating werewrittenduringlastinstruction(or FPCPSR(FloatingStatus UserGuide runusingeithertheContinuesection4.3),executionbeforethebreakpointbreakpoint,clickwhichbreakpointshouldset.Alternatively,line,thebreakpointshouldandTogglebreakpointset,largeViewtheinstructionbreakpointwasset.breakpoint,clicklinecode,whichbreakpointAlternatively,stepthroughline,whichbreakpointthenToggleBreakpointallbreakpointsselectBreakpointsNote:Breakpointsclearsthebreakpoi

ntsarecurrentlyAdditionalViewsandViewsdiscussedsectionsand4.6,respectively,ARMSim#WatchMemoryOutputandViewsusersobservesystem,wellthesystem.Thesectionsthesetionalviewsandanycommandsandsettingsassociatedthem.WatchViewWatchViewdisplaysvaluesvariablesthatthehaswatchwhichvariablestheuserwishesmonitorthe FigureBreakpoints. Whenprogramrun,justbeforeinstructionwherethebreakpoint breakpoint ARMSim#User variablewatchlist,selectWatchWatchAlternatively,rightclickWatchViewWatchmenu.Watchselectthevariablethelabelattachedthevariable;andthevariable.applicable,specifytheintegervariable,andthebase,whichrepresentationvariableshoulddisplayed.Clickremovevariablethewatchlist,thevariableWatchViewandthenselectWatchRemoveWatchremovevariableswatchWatchAlternatively,rightclickWatchViewandmenu.Notes:•AlthoughRemoveWatchtheWatchmenu,yetbeenimplemented.•TheWatchViewhowever,arrayscalarvariableandaddingwatchlist,above.MemoryViewViewthecontentsmainmemory.thisv

iew,eachcontainslowedwordsmemory8). Watch. UserGuide theentirememorycannotdisplayedMemoryViewViewshowsmemory.Thethecornerviewspecifiesword,thememorydisplayedandtheviewnumberwordsdisplayed.memory,enterhexadecimaladdressFFFFFFFFtextcornerViewAlternatively,andarrowslowerandhighermemoryrespectively.memorycanplayedbitbytes,bithalfwords,bitwords.UsethethreebuttonsWordrightViewamongtheformats.instructionexecutedusingcommandssection5.1)sequenceexecutedusingtheContinue4.3),anymemorylocationsthatwerewrittenthetheinstruction(s)highlightedtheexecutioninstruction(s)haspropertiesmemory,startingstackarea,andheaparea,canuser’spreferences.changethesePreferencesclicktheTypevaluesstartingstackarea,andheaparea,arroweachadjustthevalueClickandthenthe5.3)View(s)Notes:•Ifinstructionexecuted,valuememorycheckPreferencesmakeWriteWritesetWrite6.5settingPreferences FigureView. thesebuttonsthebit,bitbitdisplaymodes Memorylocationswrittenduringlastinstruction

(orinstructions) MemoryValues addressfirstwherethedisplaymemoryviewbegins ARMSim#User •ThehavemultipleViewsmemory.ViewsselectView•Whenthetherepresentationbytesdisplayedendrow.•Whenthesizebitassignmentaddresseslittle•InViewcellsmemoryallocatedtheshownhexadecimalE1A03000,00000000);allocatedmemoryshownquestionmarks????????).ViewViewcontainstwotabslabelled“Console”and“Stdin/Stdout/Stderr”.Selectingtablabelled“Console”bringswindowthewherethesimulatoranderrorsages.thesimulatorhasloadedtheanyassemblererrorsaredisplayedmessagedisplayedOutputViewure10),clickmessage,andscrollViewinformationdisplayedinstructionandruntimes.labelled“Stdin/Stdout/Stderr”bringswindowwheredisplayedsoftwareinterruptsI/O.eitherstandardstandarderror(Stdin/Stdout)aredisplayed PreferencesForm. UserGuide tabbedwindow.requeststandarduntilthetheechoedthiswindowwell.textOutputViewwindows,rightclickview,andmenu.cleartheViewtabbedwindow,rightclickandmenu.ViewViewsystemsta

ck.thisview,thevalueandbinaryrepresentationdisplayedsingleline,displayedwordthestack11).temstackstack. 10. ARMSim#User ViewsViewsthecontentscachecanhaveorganizations.ARMSim#executed.cacheconsisteitherandinstructioncache,displayedCacheViewseparateandinstructioncaches,displayedtheDataInstructionCacheViewsrespectively,thecacheselectedtheuser.setPreferencesandclicktab.eitherPreferencesWizardcurrentsettings,andclickrestorecacheselecttheCachePreferencesPreferencesFormthecachebeginthecache.Tableavailableconfigurations.sizecache(s).CachehasvalueSizeNumbertheremainingsettingsassumevalues,thatthreesatisfyCacheBlockNumber Figure11.View. TopStack Stack Value UserGuide thesetandReplacementFinally,selectWriteandTableConfigurationSettingsUnifiedCacheEnableDataandInstructionCachesDisableInstructionandOnlyDisableInstructionInstructionandCacheInstructionOnlyDisableInstructionandtheInstructionCacheCacheDisableInstructionand 12.CachePreferences ARM

Sim#User CacheViewsboundariessetsaremarkedsquarebracketshandside(seememoryfollowedcacheblockshowstheblockthismemory.instructionexecutedcommands5.1)sequenceexecutedusingtheContinue4.3),anyblockswerewrittentheexecutioninstruction(s)exetheinstruction(s)theWriteWriteblockmarkedrow.allblocks,CacheResettingcacheblocks,invalidatesblocks,andstatisticsallblockscache,CachecommandhastheWriteWriteviewthecachestatistics,includinghitandmissCacheallthestatistics,clicktheResetbuttondisplay.Note:•TheInstructionCachesometimesreferredCacheARMSim#learningARMarchitecture.doeseverycanARM.Somelistedbelow. 13.View. Cacheblockwaswrittenduringthelastinstruction(orinstructions) Set UserGuide •Thearchitecturelittleandmemory.littlesametheIntelwhichhostsARMSim#).•Thearchitecturehas‘Thumbintendedsystemwherememoryresource.instructioncurrentlyCodesthePlugPlughaveusedfunctionalityARMSim#tionPlugbeyondinstallationtwoandEmbestBoardThecodesextendtheARMSim#commonI/O

usesection.Note:enabledexplicitlyPreferencesappropriatefromI/OinclusivereservedbasicinstructionsneedsI/Oandshouldaltered.shownTableuselow.stronglyadvisedtheactualnumericalvalues.handshowspatternsTableOpcodeDescriptionandActionInputsOutputsEQUswi 0x00DisplayCharactercharacterswi 0x02Displayr0:addressminatedstringswi 0x11swi 0x12AllocateMemblocksizebytesr0:addressswi 0x13Deallocateswi 0x66valuesare:output,name,i.e.ASCIIstringcontainingnamer0:filehandlereturnedswi 0x68CloseFiler0:handleswi 0x69WriteFilehandleornullterminatedASCIIstring ARMSim#User SWIswicharacterbyteentity.instructiontheSWIsimulatorsuchcharacterstdoutassignedlinesbelowthecharacterlabelled“A”theStdout,followedthelinecharacter.assignmentcharacterneedsthethesyntaxStringswiAllocateswi 0x6afromFiler0:handledestinationmaxstoreswi 0x6bWriteIntegerFiler0:handleswi 0x6cIntegerFiler0:handler0:swi 0x6dGetthecurrent(milliseconds)Displayscharacterwindow. movr0,#’AswiPrChrmovr0,

#’\nswiPrChrDisplaysstringthewindow.Seealsothemorebelow. ldrr0,=MyStringswi0x02...MyString:.asciz "Hello There\n" swiSWI_Exitnewblockmemoryareaspace.memoryavailable,thespecialresultreturnedandthebitsetthe movr0,#28@get 28 bytesswiSWI_MeAllocldrr1,=Addressstrr0,[r1]...Address:.word 0TableOpcodeDescriptionandActionInputsOutputsEQU UserGuide File:swiInFileName:.asciz"Infile1.txt"InFileError:.asciz"Unable to open input file\n".alignInFileHandle:.word0thecalledandstorefile“handle”,appropriatememorylocation:.ldrr0,=InFileName@ set Name for input filemovr1,#0@ mode is inputswiSWI_Open@ open file for inputbcsInFileError@ if error?ldrr1,=InFileHandle@ load input file handlestrr0,[r1]@ save the file handleneedsloadthecontainingnametheR1,andexecute“0x66”operand.thereturninstruction,makeshasbeenproperly,messageshouldandshouldexit.output.OutFileName:.asciz"Outfile1.txt"OutFileError:.asciz"Unable to open output file\n".alignOutFileHandle:.wo

rd0thecalledandstoreits“hanappropriatememorylocation:.ldrr0,=OutFileName@ set Name for output filemovr1,#1@ mode is outputswiSWI_Open@ open file for outputbcsOutFileError@ if error ?ldrr1,=OutFileHandle@ load output file handlestrr0,[r1]@ save the file handleneedsthecontainingthenamesetandexecutetheSWI“0x66”testingthecarryreturnusingtheinstruction,makessurethathaserly,messageandshouldexit.allocatedblocksmemoryheapareaconsideredallowingmemoryrequestsmemoryblocks). swiDAlloc ARMSim#User Summary0x66instructionNote:locationsameassembleranothertioncanused.showntextWindowsTemporarydirectory.ldrr0,PathNamemovr1,#1@ output modeswiSWI_OpenPathName: .asciz "C:\\TEMP\\MyFile.txt"CloseFile:switheexecutionclosed,elseinaccessibleapplications.linesshowcloseandusedexamplesabove.WriteFile:youhaveyoursection:MatMsg:.asciz"\nThis is the resulting matrix:\n"textnamepassedspecifiesaccessexistingtextr1=1,thatalready,willoverwritten,newtextmode,tha

tanytextwrittentheend.successfully,positivehandle)returnedresultreturnedandbitset. ldrr0,=InFileNamemovr1,#0@ input modeswiSWI_OpenbcsNoFileFoundldrr1,=InFileHandlestrr0,[r1]ldrr0,=OutFileNamemovr1,#1@ output modeswiSWI_OpenbcsNoFileFoundldrr1,=OutFileHandlestrr0,[r1]OutFileHandle: .word 0InFileHandle: .word 0InFileName: .asciz "Infile1.txt"OutFileName: .asciz "Outfile1.txt"Unlesscannoteditedanotherprogram(e.g.TextPad). @ load the file handleldrr0,=InFileHandleldrr0,[r0]swiSWI_Close@ load the file handleldrr0,=OutFileHandleldrr0,[r0]swiSWI_Close UserGuide Alsoassumehasshownaboveandthatnameanditshandlestoredthelinestheshownabove.stringandfollowednewlinetheactertheldrr0,=OutFileHandle@ load the output file handleldrr0,[r0]@ R0 = file handleldrr1,=MatMsg@ R1 = address of stringswiSWI_PrStr@ output string to fileWriteIntegerFile:Writesthestringcurrenthandle,passedhavebeenearliertheOpenFile ldrr0,=OutFileHandleldrr0,[r0]ldrr1,=TextSt

ringswi0x69bcsWriteErrorTextString: .asciz "Answer = "Note:specialhandlevaluewritestringARMSim#samebriefthe movr0,#1ldrr1,=Messageswi0x69@ display messageMessage: .asciz "Hello There\n"stringhandletheareastringmaximummemory.readtheandcopiedintomemoryandnullterminatorstoredlinememory.resultreturnednumberbytesnullterminator)memory. ldrr0,=InFileHandleldrr0,[r0]ldrr1,=CharArraymovr2,#80swi0x6abcsReadErrorInFileHandle: .word 0CharArray: .skip 80ConvertsthesignedvalueandwritesstringthehandlepassedAssumeshasbeenandnameanditshandleThelinescontained ldrr0,=OutFileHandleldrr0,[r0]movr1,#42swiSWI_PrInt ARMSim#User the255havespecialusedinteractionwithPlugmodulesloadedtheARMSim#simulator.TablecurrentlisttheseBoardViewtheirwithtrations“EQU”stronglyadvisednumericalvalues.providedendsection.schematicallytheboardshownFigure14.mainavailableprogramming:1.Onesegment2.TwoNote:specialhandlevaluewritewindow.appears movr0,#1movr1,#99swi0x6b ; display

99signedThethehandlepassedresultreturnedr0.theinput,andcarry bitbeen read properly. ldrr0,=InputFileHandleldrr0,[r0]swi0x6cbcsReadError@ the integer is now in r0 A 8-segment for outputTwo LED lights Left Two buttons for input 0 5 A Keyboard for input display A small display screen for output with 40 columns and 15 lines available Figure14.viewandView UserGuide 3.Two4.Sixteenbluearrangedkeyboard5.OneLCDcolumnsindividualcells.natesLCDcellspecifiedrow}pair.Thehas{0,0},therightcoordinates{39,14}.containcharacter.TableusedEmbestOpcodeDescriptionActionInputsOutputsswi 0x200SegmentDisplay.segmentPatternbelowThesegmentslightnumbercharacterswi 0x201two.r0:Pattern,Rightbitsandmusteachsettheleftright,swi 0x202thehasNoner0Pattern,where:blackbuttonreturnsRightpressedreturnsthebitsandgetassignedthevalues).swi 0x203thehasbelowPatternbelowFigure19).swi 0x204thescreen39);screen14);nullminatedASCIIstring.andThelimitedcharactersThestringdisplaye

dstartinggivenscreen. ARMSim#User theswisegmentscharacter.segmentsassignedthecallshowsarrangementsments,andsegmentlogicallyanditsshownlistTable15,the“3”,segmentsandmustilluminated.assignedlogicalswi 0x205screen39);screen14);integerandThelimitedcharactersThestringdisplayedstartinggivenscreen.swi 0x206theNoneBlankscreen.swi 0x207characterthescreen39);screen14);character.ThelimitedcharactersThestringdisplayedstartinggivenscreen.swi 0x208linethethescreenlinenate)thescreenlineTableusedEmbestOpcodeDescriptionActionInputsOutputs UserGuide 15.SegmentsomesegmentsshownsegmentDisplay.statementsareaccessingbytevaluesassociatedthesegmentshown15.declarationgiventhethevaluesrepresentingnumberalreadytogetherwithindatastructureandappropriately.arraywordsandindexinitializedvaluerepresentinghavingthevaluestogether. Table 6: Segment byte values Example: number “3” plus “dot” P example,thethehandwouldhavevaluelogicalvaluesthesegments“A,B,C,D,F,P” 

  integer:0x20 | 0x08 | assigned statementsvaluesegmenttheDisplay. .equSEG_A,0x80.equSEG_B,0x40.equSEG_C,0x20.equSEG_D,0x08.equSEG_E,0x04.equSEG_F,0x02.equSEG_G,0x01.equSEG_P,0x1016.declarationbytevaluesforsegments ARMSim#User segmentDisplaydeclarationsgivenaboveshownFigure18.. register r0 is assignedthevaluecorrespondingtheelementthearraydigits17.the“3”,afterexecutionlinee the input registershouldcontainvalueandcontainsthee” adds 12 bytes to the address currentlyshiftedleftpositions,whichevaluates“3”12)loadswordthearray,namely:thissegmentscorrectnumber.linee the content of r1 is tested. If r1 = 1 then the segmentdisplay,withvaluewiththe possiblelarationarraywordswhichindexedthevalue{0,...,9}displayed. Digits:.wordSEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_G @0.wordSEG_B|SEG_C @1.wordSEG_A|SEG_B|SEG_F|SEG_E|SEG_D @2.wordSEG_A|SEG_B|SEG_F|SEG_C|SEG_D @3.wordSEG_G|SEG_F|SEG_B|SEG_C @4.wordSEG_A|SEG_G|SEG_F|SEG_

C|SEG_D @5.wordSEG_A|SEG_G|SEG_F|SEG_E|SEG_D|SEG_C @6.wordSEG_A|SEG_B|SEG_C @7.wordSEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F|SEG_G @8.wordSEG_A|SEG_B|SEG_F|SEG_G|SEG_C @9.word0@Blank displayFigure17.data 18.possible“Display8Segment”Registerarewherecontainsthedisplayedcontainssegment, @ *** Display8Segment (Number:R0; Point:R1) ***@ Displays the number 0-9 in R0 on the @ LED 8-segment display@ If R1 = 1, the point is also shown [1]Display8Segment:stmfdsp!,{r0-r2,lr}[2]ldrr2,=Digits[3]ldrr0,[r2,r0,lsl#2][4]tstr1,#0x01@if r1=1, [5]orrner0,r0,#SEG_P@then show “P”[6]swi0x200[7]ldmfdsp!,{r0-r2,pc} UserGuide theswipressed:thelefttheaccordingvalue movr0,#0x02swi0x201@ left LED onmovr0,#0x01swi0x201@ right LED onmovr0,#0x03swi0x201@ both LEDs onsetsblackbuttonwasrightblackbuttonwasTestactions. swi0x202cmpr0,#0x02beqActOnLeftBlackbalActOnRightBlackthecallwithtesttionexample,thenthebluewaspressed. swi0x203cmpr0,#1cmpr0,#2cmpr0,#3. . . . . butto

nhasbitthebitlowerwordafter0x203Thelabelsthethecorrespondingreturnedbuttonexample,the“1”pressed,returnsbinary,wherebit“1”hasset. Thekeypadbuttonsview. 5 A Keyboard for input FigurePatternfor ARMSim#User stringtheLCDthedisplaytheswitheCodeusefulandmultiple5.4.andARMrequiresloadingshownconstructedtwowheremaincodedassemblerandthecodedandcontainsfunction.executeARMSim#,theassemblycompiler.DisplaystringtheLCDscreenwhere=y.example,and=y=1 movr0,#4movr1,#1ldrr2,=Messageswi0x204@ display messageMessage: .asciz "Hello There\n"Displayshownwhereand=y.thisexample,r2=23,=y=123) movr0,#4movr1,#1movr2,#23swi0x205@ display integerscreen. swi0x206@ clear screenDisplaycharacterthescreen.actershown=y.example,and=y=1linecolumn movr0,#4movr1,#1movr2,#’Zswi0x207@display charLCDscreen,thegiven ldrr0,#5swi0x208@clear line 5 UserGuide crosscompilingandprofessionalversionavailablesite:CodeG++Editionhttp://www.codesourcery.com/sgpp/lite/armostcommandshave

beenlinkedTextPadforeasyandbothshownhere.assumeCodehasbeeninstalledtheAllthecommandsbelow1.Inwindowthecommand: LDRR0,=Num1LDRR0,[R0]@ first parameter passed in R0LDRR1,=Num2LDRR1,[R1]@ second parameter passed in R1BLmyAdd@ R0 = myAdd(Num1:R0,Num2:R1)11:LDRR4,=AnswerSTRR0,[R4]@ result was returned in R0SWI0x11Num1:.word537Num2:.word-237 20.Assemblerexample ARMCode ARMSim#User Or,TextPaduse:thereareerrorscrosscompilercreateARMassemblynamedtellsstopaftersteptranslatingassemblylanguage.2.TosimplershouldtryTextPadTextPad3.Theassemblycanconvertedwith:TextPadSimilarlymainARMconvertedARMassemblyTextPad4.Alternatively,compileusing:TextPadLinkingtheProgramthiscombineintoacceptablechoicesarebelow.shouldanythecombinationslisted.ARMSim#loadsandlinkstheassemblingnecessary.ARMSim#linkandexecuteanyabove.executionthecodeshiftsbetweenmodulesinstructioninvoked.compilergcctranslatewhichthestandardforshort),whengivencommandlineAPCSrulesAddMain.sAddM

ain.sAddMain.oAddMain.omyAdd.smyAdd.omyAdd.smyAdd.o UserGuide •TheargumentspassedR1,andrespectively.therefewerargumentstheregistersused.)alwaysalwaysalwaysalways•Anyargumentsstack.•Thereturnvaluealwaysgoes•TheandR12“scratch”).canusetheseregisterscomputationsandrestorevalues•Themustpreservethecontentscourse).callingconventionsversionimplementscallingconventionsandtreatsandR12“callersave”registers,responsibilitysavestackbeforeinstructionandrestoreafterreturn.files:1.“containsmaincallstheyetthe2.“containswhichcallsmain3.“containsStrings,IntegersStdoutI/O@@@ PRINT STRINGS, CHARACTERS, INTEGERS TO STDOUT.equSWI_PrChr,0x00 @ Write an ASCII char to Stdout.equSWI_PrStr, 0x69 @ Write a null-ending string .equSWI_PrInt,0x6b@ Write an Integer.equStdout,1@ Set output mode to be Output View.equSWI_Exit, 0x11 @ Stop execution.global _start.text_start:@ print a string to StdoutmovR0,#Stdout@ mode is StdoutldrR1, =Message1 @ load address of

Message1swiSWI_PrStr @ display message to Stdout@ print a new line as a string to StdoutmovR0,#Stdout@ mode is Stdoutldrr1, =EOL@ end of lineswiSWI_PrStr@ print a character to the screenmovR0, #'A @ R0 = char to print swiSWI_PrChr ARMSim#User @ print a blank character (from data)ldrr0,=Blankldrbr0,[r0]@ R0 = char to print = blankswiSWI_PrChr@ print a second character to StdoutmovR0, #'B @ R0 = char to print swiSWI_PrChr @ print a new line as a character to Stdoutldrr0,=NewLldrbr0,[r0]@ R0 = char to print = new lineswiSWI_PrChr@ print an integer to StdoutmovR0,#Stdout@ mode is Output viewmovr1, #42@ integer to printswiSWI_PrInt@ print a new line as a string to StdoutmovR0,#Stdout@ mode is Output viewldrr1, =EOL@ end of line .equSWI_Exit, 0x11@ Local Constants.equSWI_PrintInt, 0x6B.equSWI_PrintChar, 0x0.equStdout, 1.equEndInput,-1.global_start@ Exported Symbols.globalPrint.externCompute@ Imported Symbols.text@ ma

in()ldrr0, =inputsmovr1,#EndInputblComputeswiSWI_Exitstmfdsp!, {r0,r1,lr} @ YES, we do need this!movr1, r0 @ R1:value-to-print = R0:arg1movr0, #Stdout @ print to consoleswiSWI_PrintInt @ PrintInt(R0:where, R1:value)movr0, #0x0A @ ASCII new-line characterswiSWI_PrintChar @ PrintChar(R0:value)ldmfdsp!, {r0,r1,pc} @ YES, we do need this! “ARM_Main.s”:ARMforExample UserGuide swiSWI_PrStrswiSWI_Exit @ stop executing: end of program.dataMessage1: .asciz"Hello World!"EOL:.asciz"\n"NewL:.ascii"\n"Blank:.ascii" ".endOpenprintusing@@@ OPEN INPUT FILE, READ INTEGER FROM FILE, PRINT IT, CLOSE INPUT FILE.equSWI_Open, 0x66@open a file.equSWI_Close,0x68@close a file.equSWI_PrChr,0x00 @ Write an ASCII char to Stdout.equSWI_PrStr, 0x69 @ Write a null-ending string .equSWI_PrInt,0x6b@ Write an Integer.equSWI_RdInt,0x6c@ Read an Integer from a file.equStdout,1@ Set output target to be Stdout.equSWI_Exit, 0x11 @ Stop execution.glo

bal _start.text_start:@ print an initial message to the screenmovR0,#Stdout@print an initial message ldrR1, =Message1 @ load address of Message1 labelswiSWI_PrStr @ display message to Stdout@ == Open an input file for reading =============================@ if problems, print message to Stdout and exitldrr0,=InFileName@ set Name for input filemovr1,#0@ mode is inputswiSWI_Open@ open file for inputbcsInFileError @ Check Carry-Bit (C): if= 1 then ERROR@ Save the file handle in memory:ldrr1,=InputFileHandle@ if OK, load input file handlestrr0,[r1]@ save the file handle@ == Read integers until end of file =============================RLoop:ldrr0,=InputFileHandle@ load input file handleldrr0,[r0]swiSWI_RdInt@ read the integer into R0bcsEofReached@ Check Carry-Bit (C): if= 1 then EOF reached@ print the integer to Stdoutmovr1,r0@ R1 = integer to printmovR0,#Stdout@ target is StdoutswiSWI_PrIntmovR0,#Stdout@ print new lineldrr1, =NLswi

SWI_PrStrbalRLoop@ keep reading till end of file@ == End of file =============================================== ARMSim#User EofReached:movR0, #Stdout@ print last messageldrR1, =EndOfFileMsgswiSWI_PrStr@ == Close a file ===============================================ldrR0, =InFileHandle @ get address of file handleldrR0, [R0] @ get value at addressswiSWI_CloseExit:swiSWI_Exit @ stop executing InFileError:movR0, #StdoutldrR1, =FileOpenInpErrMsgswiSWI_PrStr balExit @ give up, go to end.data.alignInFileHandle:.skip4InFileName: .asciz"whatever.txt"FileOpenInpErrMsg: .asciz"Failed to open input file \n"EndOfFileMsg: .asciz"End of file reached\n"ColonSpace: .asciz": "NL:.asciz"\n"@ new line Message1: .asciz"Hello World! \n".endtemplate.equSWI_SETSEG8,0x200@display on 8 Segment.equSWI_SETLED,0x201@LEDs on/off.equSWI_CheckBlack,0x202@check Black button.equSWI_CheckBlue,0x203@check press Blue button.equSWI_DRAW_STRING,0x204@displa

y a string on LCD.equSWI_DRAW_INT,0x205@display an int on LCD.equSWI_CLEAR_DISPLAY,0x206@clear LCD.equSWI_DRAW_CHAR,0x207@display a char on LCD.equSWI_CLEAR_LINE,0x208@clear a line on LCD.equSWI_EXIT,0x11@terminate program.equSWI_GetTicks,0x6d@get current time .equ SEG_A,0x80@ patterns for 8 segment display.equ SEG_B,0x40@byte values for each segment.equ SEG_C,0x20@of the 8 segment display.equ SEG_D,0x08.equ SEG_E,0x04.equ SEG_F,0x02.equ SEG_G,0x01.equ SEG_P,0x10.equLEFT_LED,0x02@bit patterns for LED lights.equRIGHT_LED,0x01 UserGuide .equLEFT_BLACK_BUTTON,0x02@bit patterns for black buttons.equRIGHT_BLACK_BUTTON,0x01@and for blue buttons.equBLUE_KEY_00,0x01@button(0).equBLUE_KEY_01,0x02@button(1).equBLUE_KEY_02,0x04@button(2).equBLUE_KEY_03,0x08@button(3).equBLUE_KEY_04,0x10@button(4).equBLUE_KEY_05,0x20@button(5).equBLUE_KEY_06,0x40@button(6).equBLUE_KEY_07,0x80@button(7).equBLUE_KEY_00,18@button(8) - different way to set.equB

LUE_KEY_01,19@button(9).equBLUE_KEY_02,110@button(10).equBLUE_KEY_03,111@button(11).equBLUE_KEY_04,112@button(12).equBLUE_KEY_05,113@button(13).equBLUE_KEY_06,114@button(14).equBLUE_KEY_07,115@button(15)the@ Wait(Delay:r2) wait for r2 millisecondsWait:stmfdsp!, {r0-r1,lr}swiSWI_GetTicksmovr1, r0 @ R1: start timeWaitLoop:swiSWI_GetTickssubsr0, r0, r1 @ R0: time since startrsbltr0, r0, #0 @ fix unsigned subtractcmpr0, r2bltWaitLoopWaitDone:ldmfdsp!, {r0-r1,pc}bittimerARMSim#bitquantityandcurrenttimeaccessedcorrespondingsetthemilliseconds.hand,thetheEmbestbitcauserollover.AssumecheckstimestartingthenT2,andneedswhethercertainamounthascomputingandcomparingintervalrangetimerbetweenand4,294,967,295.milliseconds,gives71,582minutes,whichnormallyenoughtheintervalseverexecution.rangeboardtimerbetweenand32,767,rangeseconds.checkingintervaltherelongandT22,767.Howeverthatandsubsequentlyhasvaluerollover,T2enoughtheexamplesshow. ARMSim#User 1,0

00and15,000.Then14,000givescorrectanswerinterval.quently30,000andthe2,000thehasrolledover).onesimplycalculates28,000eventriesabsolutevalue,answerincorrect.valueintervalshouldbe: ‐ 32,76730,0002,0004,767,whichrepresentsthecorrectnumberbetweenandTwothingsneedcorrectprogramming.valueARMSim#should“masked”bitquantity,thattheworkthesimulaandtheboard.Secondly,testingintervalincluderollover..equSec1, 1000 @ 1 seconds interval.equPoint1Sec, 100 @ 0.1 seconds interval.equEmbestTimerMask,0x7fff @ 15 bit mask for timer values.equTop15bitRange,0x0000ffff@(2^15) -1 = 32,767.text_start:movr6,#0@ counting the loops (not necessary)ldrr8,=Top15bitRangeldrr7,=EmbestTimerMaskldrr10,=Point1SecSWISWI_GetTicks@Get current time T1movr1,r0@ R1 is T1andr1,r1,r7@ T1 in 15 bitsRepeatTillTime:addr6,r6,#1@ count number of loops (not necessary)SWISWI_GetTicks@Get current time T2movr2,r0@ R2 is T2andr2,r2,r7@ T2 in 15 bitscmpr2,r1@ is  T2T1?bgesi

mpletimesubr9,r8,r1@ TIME= 32,676 - T1addr9,r9,r2@ + T2balCheckIntsimpletime:subr9,r2,r1@ TIME = T2-T1CheckInt:cmpr9,r10@is TIME ?bltRepeatTillTimeswiSWI_EXIT.endView)@ Demonstration of Embest S3CE40 development board view@ ===== Assume the EQU declaration from previous examples@Clear the board, clear the LCD screenswiSWI_CLEAR_DISPLAY@Both LEDs offmovr0,#0swiSWI_SETLED@8-segment blank UserGuide movr0,#0swiSWI_SETSEG8@draw a message to the lcd screen on line#1, column 4movr0,#4@ column numbermov r1,#1@ row numberldrr2,=Welcome@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen@display the letter H in 7segment displayldrr0,=SEG_B|SEG_C|SEG_G|SEG_E|SEG_FswiSWI_SETSEG8@turn on LEFT led and turn off RIGHT ledmovr0,#LEFT_LEDswiSWI_SETLED@draw a message to the lcd screen on line#2, column 4movr0,#4@ column numbermov r1,#2@ row numberldrr2,=LeftLED@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen@Wait for 3 sec

ondldrr3,=3000BL Wait@turn on RIGHT led and turn off LEFT ledmovr0,#RIGHT_LEDswiSWI_SETLED@draw a message to the lcd screen on line#2, column 4movr0,#4@ column numbermov r1,#2@ row numberldrr2,=RightLED@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen@Wait for 3 secondldrr3,=3000BL Wait@turn on both ledmovr0,#(LEFT_LED|RIGHT_LED)swiSWI_SETLED@clear previous line 2movr0,#2swiSWI_CLEAR_LINE@draw a message to inform user to press a black buttonmovr0,#6@ column numbermov r1,#2@ row numberldrr2,=PressBlackL@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen@wait for user to press a black buttonmov r0,#0LB1:swiSWI_CheckBlack@get button press into R0cmpr0,#0beqLB1@ if zero, no button pressedcmpr0,#RIGHT_BLACK_BUTTON ARMSim#User bneLD1ldrr0,=SEG_B|SEG_C|SEG_F @right button, show -|swiSWI_SETSEG8movr0,#RIGHT_LED@turn on right ledswiSWI_SETLEDbalNextButtonsLD1:@left black pressed ldrr0,=SEG_G|SEG_E|SEG_F@display |-

on 8segmentswiSWI_SETSEG8movr0,#LEFT_LED@turn on LEFT ledswiSWI_SETLEDNextButtons:@Wait for 3 secondldrr3,=3000BL Wait@Test the blue buttons 0-9 with prompting, then display@number on 8-segment for 3 second�s. If 9, invalid.@Draw a message to inform user to press a blue buttonmovr0,#2@clear previous line 2swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#2@ row numberldrr2,=PressBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmov r4,#16BLUELOOP:@wait for user to press blue buttonmov r0,#0BB1:swiSWI_CheckBlue@get button press into R0cmpr0,#0beqBB1@ if zero, no button pressedcmpr0,#BLUE_KEY_15beqFIFTEENcmpr0,#BLUE_KEY_14beqFOURTEENcmpr0,#BLUE_KEY_13beqTHIRTEENcmpr0,#BLUE_KEY_12beqTWELVEcmpr0,#BLUE_KEY_11beqELEVENcmpr0,#BLUE_KEY_10beqTENcmpr0,#BLUE_KEY_09beqNINEcmpr0,#BLUE_KEY_08beqEIGHTcmpr0,#BLUE_KEY_07beqSEVEN UserGuide cmpr0,#BLUE_KEY_06beqSIXcmpr0,#BLUE_KEY_05beqFIVEcmpr0,#BLUE_KEY_04beqFOURcmpr0,#BLUE_KE

Y_03beqTHREEcmpr0,#BLUE_KEY_02beqTWOcmpr0,#BLUE_KEY_01beqONEcmpr0,#BLUE_KEY_00movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#0BLDisplay8SegmentbalCKBLUELOOPONE:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#1BLDisplay8SegmentbalCKBLUELOOPTWO:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#2BLDisplay8SegmentbalCKBLUELOOPTHREE:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#3BLDisplay8SegmentbalCKBLUELOOPFOUR:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#4BLDisplay8SegmentbalCKBLUELOOPFIVE:movr0,#5@clear previous line swiSWI_CLEAR_LINE ARMSim#User movr1,#0movr0,#5BLDisplay8SegmentbalCKBLUELOOPSIX:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#6BLDisplay8SegmentbalCKBLUELOOPSEVEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#7BLDisplay8SegmentbalCKBLUELOOPEIGHT:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#8BLDisplay8Seg

mentbalCKBLUELOOPNINE:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr1,#0movr0,#9BLDisplay8SegmentbalCKBLUELOOPTEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmovr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentbalCKBLUELOOPELEVEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen UserGuide movr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentbalCKBLUELOOPTWELVE:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmovr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentbalCKBLUELOOPTHIRTEEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlu

e@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmovr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentbalCKBLUELOOPFOURTEEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmovr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentbalCKBLUELOOPFIFTEEN:movr0,#5@clear previous line swiSWI_CLEAR_LINEmovr0,#6@ column numbermov r1,#5@ row numberldrr2,=InvBlue@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screenmovr1,#0movr0,#10@ clear 8-segmentBLDisplay8SegmentCKBLUELOOP:movr0,#10@clear previous line swiSWI_CLEAR_LINE ARMSim#User movr0,#4@clear previous line swiSWI_CLEAR_LINEmovr0,#1@ display number of testsmov r1,#4ldrr2,=TestBlueswiSWI_DRAW_STRINGmov r0,#10mov r1,#4mov r2,r4swiSWI_DRAW_INTsubsr4,r4,#1bneBLUELOOP@give only 15 tests@Prepare to exit: lst message and clear the board@draw a message to the lcd s

creen on line#10, column 1movr0,#1@ column numbermov r1,#10@ row numberldrr2,=Bye@ pointer to stringswiSWI_DRAW_STRING@ draw to the LCD screen@Turn off both LED'sldrr0,=0swiSWI_SETLED@8-segment blankmovr0,#0swiSWI_SETSEG8ldrr3,=2000@delay a bitBLWait@Clear the LCD screenswiSWI_CLEAR_DISPLAYswiSWI_EXIT@all done, exit@ ===== Display8Segment (Number:R0; Point:R1) @ Displays the number 0-9 in R0 on the 8-segment display@ If R1 = 1, the point is also shownDisplay8Segment:stmfdsp!,{r0-r2,lr}ldrr2,=Digitsldr r0,[r2,r0,lsl#2]tst r1,#0x01 @if r1=1,orrner0,r0,#SEG_P @then show Pswi SWI_SETSEG8ldmfd sp!,{r0-r2,pc}@ ===== Wait(Delay:r3) wait for r3 milliseconds@ Delays for the amount of time stored in r3 for a 15-bit timerWait:stmfdsp!,{r0-r5,lr}ldrr4,=0x00007FFF@mask for 15-bit timerSWISWI_GetTicks@Get start timeandr1,r0,r4@adjusted time to 15-bitWloop:SWISWI_GetTicks@Get current timeandr2,r0,r4@adjusted time to 15-bit UserGuide cmpr2,r1bl

tRoll@rolled above 15 bitssubr5,r2,r1@compute easy elapsed timebalCmpLoopRoll:subr5,r4,r1@compute rolled elapsed timeaddr5,r5,r2CmpLoop:cmpr5,r3@is elapsed time delay?bltWloop@Continue with delayXwait:ldmfdsp!,{r0-r5,pc}@ ================================================.dataWelcome:.asciz"Welcome to Board Testing"LeftLED:.asciz"LEFT light"RightLED:.asciz"RIGHT light"PressBlackL:.asciz"Press a BLACK button"Bye:.asciz"Bye for now."Blank:.asciz" "Digits:.word SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_G @0.word SEG_B|SEG_C @1.word SEG_A|SEG_B|SEG_F|SEG_E|SEG_D @2.word SEG_A|SEG_B|SEG_F|SEG_C|SEG_D @3.word SEG_G|SEG_F|SEG_B|SEG_C @4.word SEG_A|SEG_G|SEG_F|SEG_C|SEG_D @5.word SEG_A|SEG_G|SEG_F|SEG_E|SEG_D|SEG_C @6.word SEG_A|SEG_B|SEG_C @7.word SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F|SEG_G @8.word SEG_A|SEG_B|SEG_F|SEG_G|SEG_C @9.word 0 @Blank displayPressBlue:.asciz"Press a BLUE button 0-9 only - 15 tests"InvBlue:.asciz"Invalid blue button - try

Related Contents


Next Show more