0% found this document useful (0 votes)
2 views

ECE331 HW 2 Addressing Mode Homework

This document is a homework assignment for an ECE331 course focused on addressing modes in 9S12Cxx Assembly programming. It contains a series of assembly code instructions with comments that require students to fill in the values of registers and memory locations after execution. The assignment is due on September 16, 2010, and includes sections for both RAM and Flash ROM memory allocation.

Uploaded by

rossini444
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ECE331 HW 2 Addressing Mode Homework

This document is a homework assignment for an ECE331 course focused on addressing modes in 9S12Cxx Assembly programming. It contains a series of assembly code instructions with comments that require students to fill in the values of registers and memory locations after execution. The assignment is due on September 16, 2010, and includes sections for both RAM and Flash ROM memory allocation.

Uploaded by

rossini444
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1

; ECE331 HW 2 Addressing Mode Homework. Due Thursday 9/16/10

; NAME: _____________________________ Box #___________

; This is an 9S12Cxx Assembly Program


; Fill in ALL blanks in the comment fields
; with the proper value(s) AFTER the
; commented line has executed.
;**********************************************************

XDEF Entry ; export 'Entry' symbol


ABSENTRY Entry ; for absolute assembly

ORG $0400 ;$0400 = Start of RAM


var1: rmb 1 ;(NOTE: rmb = Reserve memory byte = DS.B = define space byte)
vararray1: rmb 10
var2: ds.b 1

ORG $4000 ;$4000 = Start of Flash ROM


const1: dc.b 3,2,7,8 ;(fcb = Form constant byte = DC.B = define constant byte)
const2: fcb %10011010,%01011100 ;"%" => binary
const3: fcb 'ECE331',0 ;(Note ASCII strings can be allocated into memory using quotes and fcb)
const4: fcb $0b,$ad,$fa,$d0
const5: dc.w $0bad,$deed ;(fdb = Form double byte = DC.W)
adrconst1: fdb const1
adrconst2: fdb const2
adrconst3: fdb const3

PTT: EQU $240 ;Port T Data I/O Register Address


DDRT: EQU $242 ;Port T Data Direction Register Address

Entry: ldd #4000 ;d = $_______


;b = $____ a = $____ (careful --- recall that D = A:B)
ldd #$4000 ;d = $_______
ldd $4000 ;d = $_______
ldab #-1 ;b = $______
ldab #$ff ;b = $_____
ldy Entry ;y = $______
ldy #Entry ;y = $______
ldy #Entry-(3*2) ;y = $______
ldx const1 ;x = $_____
ldaa const1+2 ;a = $_______

ldaa #$55 ;Note that assembler is case insensitive


staa DDRT ;DDRT contains $_____
ldaa #%01101100 ;Note that the "%" prefix => binary
2
staa PTT ;List the four Port T pins
;that are output pins, and indicate
;their value
;___________ ____________ __________ __________
;Assume outside world drives the
;the following input signals into
;the four PTT input pins:
;PT7 = High, PT5 = Low, PT3 = High, PT1 = Low.
ldaa PTT ; a = $______
ldx #const2
ldaa 0,x ;x = $______, a = $_______
ldd 0,x ;x = $______, d = $_______
inx
ldab 0,x ;x = $______, b = $_______
ldy #const4
ldaa 1,y ;y = $______ a = $_____
ldd 2,y ;y = $______ d = $________
ldy 3,y ;y = $______
ldy #2
ldy const1,y ;y = $_______
ldy 0,pc ;y = $_______ ;Recall PC points to op
ldy 3,pc ;y = $_______ ;code of next instruction.
ldx #const4
ldaa 1,+x ;x = $_______ a = $______
ldaa 1,+x ;x = $_______ a = $______
ldx #const4
ldaa 1,x+ ;x = $_______ a = $______
ldaa 1,x+ ;x = $_______ a = $______
ldx #const5
ldd 2,-x ;x = $_______ d = $______
ldd 2,-x ;x = $_______ d = $______
ldx #const5
ldd 2,x- ;x = $_______ d = $______
ldd 2,x- ;x = $_______ d = $______
ldy #var2
ldd #$1234
std 2,-y ;y = $_______
ldd const2 ;d = $_______
std 2,-y ;y = $_______
ldd const3 ;d = $_______
std 2,-y ;y = $_______ <-------Fill in the contents
ldd 2,y+ ;d = $_______, y = $______ of RAM (below) after
ldd 2,y+ ;d = $_______, y = $______ this instruction executes
ADDR Contents
ldd 2,y+ ;d = $_______, y = $______ $040B -------
ldx #const3 $040A _____
ldaa #2 $0409 _____
ldab a,x ;a = $______, b = $______ $0408 _____
inca $0407 _____
ldab a,x ;a = $______, b = $______ $0406 _____
ldd #2 $0405 _____
3
ldab d,x ;d = $______, b = $______
ldx #0
ldaa [adrconst1,x] ;x = $______, a = $_____
inx
inx
ldaa [adrconst1,x] ;x = $______, a = $_____
inx
inx
ldd [adrconst1,x] ;x = $_____, d = $______
ldd #adrconst1
ldx #0
ldy [d,x] ;x = $_______, y = $_______
inx
inx
ldy [d,x] ;x = $_______, y = $_______
ldaa #1
ldab #2
ldx #3
aba ;b = $_____ a = $______
nop ;b = $_____ a = $______
abx ;b = $_____ x = $_________
exg a,b ;a = $_____ b = $______
inx ;x = $_________
dex ;x = $_________
ldaa #3
ldab #0
ldx #const4
here: addb a,x
deca
nop
nop
nop
bne here ;Displacement byte that follows this “bne” OPCODE = $____
bra skip ;Displacement byte that follows this “bra” OPCODE = $____
nop
nop
nop
nop
skip: nop ;a = $____, b = $_____
done: bra done ;Displacement byte that follows this “bra” OPCODE = $____

;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
fdb Entry ; Reset Vector initialized with starting address of program

You might also like