What is the programming model of a HCS12 microcontroller? Solution Programming m
ID: 3584438 • Letter: W
Question
What is the programming model of a HCS12 microcontroller?Explanation / Answer
Programming model of HCS12 micro controller: Address Mode Notation INH — Inherent; no operands in object code IMM — Immediate; operand in object code DIR — Direct; operand is the lower byte of an address from $0000 to $00FF EXT — Operand is a 16-bit address REL — Two’s complement relative offset; for branch instructions IDX — Indexed (no extension bytes); includes: 5-bit constant offset from X, Y, SP, or PC Pre/post increment/decrement by 1 . . . 8 Accumulator A, B, or D offset IDX1 — 9-bit signed offset from X, Y, SP, or PC; 1 extension byte IDX2 — 16-bit signed offset from X, Y, SP, or PC; 2 extension bytes [IDX2] — Indexed-indirect; 16-bit offset from X, Y, SP, or PC [D, IDX] — Indexed-indirect; accumulator D offset from X, Y, SP, or PC Machine Coding dd — 8-bit direct address $0000 to $00FF. (High byte assumed to be $00). ee — High-order byte of a 16-bit constant offset for indexed addressing. eb — Exchange/Transfer post-byte. See Table A-5 on page 405. ff — Low-order eight bits of a 9-bit signed constant offset for indexed addressing, or low-order byte of a 16-bit constant offset for indexed addressing. hh — High-order byte of a 16-bit extended address. ii — 8-bit immediate data value. jj — High-order byte of a 16-bit immediate data value. kk — Low-order byte of a 16-bit immediate data value. lb — Loop primitive (DBNE) post-byte. See Table A-6 on page 406. ll — Low-order byte of a 16-bit extended address BEGIN LDY #TABLE_START-2 ;setup initial table pointer FIND_LOOP CMPA 2,+Y ;find first Xn > XL ;(auto pre-inc Y by 2) BLS FIND_LOOP ;loop if XL .le. Xn * on fall thru, XB@-2,Y YB@-1,Y XE@0,Y and YE@1,Y TFR D,X ;save XL in high half of X CLRA ;zero upper half of D LDAB 0,Y ;D = 0:XE SUBB -2,Y ;D = 0:(XE-XB) EXG D,X ;X = (XE-XB).. D = XL:junk SUBA -2,Y ;A = (XL-XB) EXG A,D ;D = 0:(XL-XB), uses trick of EXG FDIV ;X reg = (XL-XB)/(XE-XB) EXG D,X ;move fractional result to A:B EXG A,B ;byte swap - need result in B TSTA ;check for rounding BPL NO_ROUND INCB ;round B up by 1 NO_ROUND LDAA 1,Y ;YE PSHA ;put on stack for TBL later LDAA -1,Y ;YB PSHA ;now YB@0,SP and YE@1,SP TBL 2,SP+ ;interpolate and deallocate ;stack temps
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.