50 likes | 232 Views
Intro to CodeWarrior TM. Simulating the Microcontroller in Assembly Language Freescale Univeristy Programs Document Labs12CINTRO03/Rev1. Simulation Program. ; Your program code goes here ; Initialize I/O main_loop : ; DO nop ; A "no operation" operation
E N D
Intro to CodeWarrior TM Simulating the Microcontroller in Assembly Language FreescaleUniveristy Programs Document Labs12CINTRO03/Rev1
Simulation Program • ; Your program code goes here • ; Initialize I/O • main_loop: • ; DO • nop ; A "no operation" operation • ldx#ConstData ; Initialize X with an address • ldab#$02 ; Initialize a counter with data
Simulation (cont.) • ; Load and store data in a loop • loop: • ldaa0,x ; Get the data • staaVarData ; Store it in RAM • ldaa2,x ; Get another byte • staaVarData+1 ; Store it • Inx ; Increment the pointer • decb ; Decrement the counter
Simulation (cont.) • bne loop ; Loop until B = 0 • nop • ; Forever • bra main_loop
Simulation (cont.) • ;***************************************MyConst: SECTION • ; Place constant data here • ConstData: DC.B $0a,$0b,$11,10 • ;*************************************** • MyData: SECTION • ; Place variable data here • VarData: DS.B 2 ; Two bytes of storage