EE3376 Programs EE3376 Home

"demo_sim" program

This is the "demo_sim" program used for the Code Warrior assembly tutorial. This version runs on the Simulator; simply remove the interrupt vector code if it is to run on the HCS12 with DBug12 running.


;****************************************************************
;*
;* UTEP EE3376 Assembly demo program "demo_sim.asm"
;* 18 Oct 03
;* 
;* Simple absolute assembly program to demonstrate the steps to create an
;* executable program using Code Warrior software assembly tools. The
;* program simply adds two numbers and then stores the result in memory.
;*
;* This program runs on the HCS12 Simulator, and needs the reset vector.
;* Based on code from "demo_hcs12.asm"
;*
;****************************************************************

; export symbols
            XDEF Entry        ; export 'Entry' symbol
            ABSENTRY Entry    ; for absolute assembly: mark this as application entry point


PSEUDO_ROM    		EQU  $1000  ; absolute address to place code/constant data
RAM		    	EQU  $1100  ; absolute address to place variables

;-----------------------------------------------------
; variable/data section
            ORG RAM
; Insert your data definitions here. 
num1:	dc.b	$2a		; first number = 42 decimal
num2:	dc.b	$18		; second number = 24 decimal
res1:	ds.b	1		; reserve one byte for result

;------------------------------------------------------
; code section
	ORG	PSEUDO_ROM	;set PC to $1000
	
; Enter your code following the "Entry" label.
Entry:

	ldaa	num1		; the first number
	adda	num2		; add second number to A and store in A
	staa	res1		; store result in memory
	swi			; end the program

;------------------------------------------------------
; Interrupt Vectors - we need this to run on the Simulator correctly
  	ORG $FFFE		  

  	fdb     Entry      ; Reset
;****************************************************************



EE3376 Programs EE3376 Home