{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture38 - C\Documents and Settings\rwmeec\My...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
C:\Documents and Settings\rwmeec\My Documents\Class\250\20091\Lecture38.asm Page 1 of 2 TITLE "0306-250 Lecture 38 Example" ;*************************************************************** ; Lecture 38 Example ; Demonstrates assembly of various HCS12 instructions ; ; Name: Roy W. Melton ; Date: November 10, 2009 ; Class: 0306-250 ;*************************************************************** ; Set assembler options: ; MLIST ON turns on macro expansion in the listing file. MLIST ON ;*************************************************************** ; export symbols XDEF Entry, main ; Allows "Entry" to be refereneced either ; in the linker .prm file or from C/C++ XREF __SEG_END_SSTACK ; symbol defined by linker for end of stack ; include derivative specific macros INCLUDE 'mc9s12dt256.inc' ;********************************************************************** MyCode: SECTION main: Entry: ;Assembly of clear instructions clra clrb clr ByteVar1 ;Assembly of mov instructions movb #$AB,ByteVar2 movw #$CDEF,WordVar1 movw WordVar1,WordVar2 ;Assembly of tfr instructions tfr a,b tfr a,x ;Assembly of adda instructions adda #1 adda ByteVar2 ;Assembly of ldx instruction ldx #ByteVar1 ;Assembly of ldaa instructions ldaa #1 ldaa ByteVar1 ldaa 0,x ldaa 1,x ldaa 1,x+ ldaa 1,x- ldaa 1,+x ldaa 1,-x ldaa 255,x ldaa -255,x ldaa 257,x ldaa -257,x Done: bra * ;********************************************************************** ; Constants ;********************************************************************** ; Variables C:\Documents and Settings\rwmeec\My Documents\Class\250\20091\Lecture38.asm Page 2 of 2 MyData: SECTION ByteVar1: DS.B 1 ByteVar2: DS.B 1 WordVar1: DS.W 1 WordVar2: DS.W 1 ;********************************************************************** END
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
C:\Documents and Settings\rwmeec\My Documents\Class\250\20091\Lecture38.lstmap Page 1 of 1 0306-250 Lecture 38 Example Final machine language after assembly and link ============================================== 87 clra ---------------------------------------------- C7 clrb ---------------------------------------------- 79 11 00 clr ByteVar1 ---------------------------------------------- 18 0B AB 11 01 movb #$AB,ByteVar2 ---------------------------------------------- 18 03 CD EF 11 02 movw #$CDEF,WordVar1 ---------------------------------------------- 18 04 11 02 11 04 movw WordVar1,WordVar2 ---------------------------------------------- B7 01 tfr a,b ---------------------------------------------- B7 05 tfr a,x ---------------------------------------------- 8B 01 adda #1 ---------------------------------------------- BB 11 01 adda ByteVar2 ---------------------------------------------- CE 11 00 ldx #ByteVar1 ---------------------------------------------- 86 01 ldaa #1 ---------------------------------------------- B6 11 00 ldaa ByteVar1 ---------------------------------------------- A6 00 ldaa 0,x ---------------------------------------------- A6 01 ldaa 1,x ---------------------------------------------- A6 30 ldaa 1,x+ ---------------------------------------------- A6 3F ldaa 1,x- ---------------------------------------------- A6 20 ldaa 1,+x ---------------------------------------------- A6 2F ldaa 1,-x ---------------------------------------------- A6 E0 FF ldaa 255,x ---------------------------------------------- A6 E1 01 ldaa -255,x ---------------------------------------------- A6 E2 01 01 ldaa 257,x ---------------------------------------------- A6 E2 FE FF ldaa -257,x ---------------------------------------------- 20 FE bra *
Background image of page 2
˝°±²—¸˚± ˛»”»fi»²‰» ³¿²«¿·´ ˛»“µ ¶µ¹ °ØL ±fi»»›‰¿·» ˝»‡•‰–²…«‰‹–fi ³´»fi¿‹–fi› l‰–²‹•²«»…µ O ¶–„•‰¿· »¤‰·«›•“» ³˛ I O ¸«·‹•´·•‰¿‹•–² ) O ¹•“•›•–² ¸ O º»„¿‹•–²¼ ³²»K› ‰–‡´·»‡»²‹ l•²“»fi‹ »¿‰‚ ½•‹ –” ¸µ ¾ O À–²‰¿‹»²¿‹» Á¤¿‡´·»¾  ¾ à ‡»¿²› ‹‚» ÄOEŽ•‹ “¿·«» ”–fi‡»… ½§ ‰–²‰¿‹»²¿‹•²„ LŽ•‹ ¿‰‰«‡«·¿‹–fi  '•‹‚ LŽ•‹ ¿‰‰«‡«·¿‹–fi ü  •› •² ‹‚» ‚•„‚Å–fi…»fi ´–›•‹•–²¼ O Æfi¿²›”»fi Á¤¿‡´·»¾ lµ ¸ ‡»¿²› ‹‚» ‰–²‹»²‹ –” ¿‰‰«‡«·¿‹–fi  •› ‹fi¿²›”»fifi»… ‹– ‡»‡–fi§ ·–‰¿‹•–² ¸¼ O Á¤‰‚¿²„» Á¤¿‡´·»¾ ¹ ¨ ‡»¿²› »¤‰‚¿²„» ‹‚» ‰–²‹»²‹› –” ¹ '•‹‚ ‹‚–›» –” ¨¼ Â……fi»›› ¸–…» º–‹¿‹•–² ÇºÈ O Dz‚»fi»²‹É ²– –´»fi¿²…› •² –½¶»‰‹ ‰–…» Ǹ¸ O
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}