HW_6_Solutions

HW_6_Solutions - kbdin Solution: 2. Programming: ADDBCD.x68...

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

View Full Document Right Arrow Icon
ECE252 Microprocessor Fall 2008 Homework #6 Solutions, 100 Points Due on Oct. 28, 2008 1. Programming: K B D I N . x 6 8 ( 5 0 p t s ) ; At KBDBUF we have some arbitrary string of 5 ASCII ; digits, the most significant is first. Convert this ; string of 5 ASCII digits to a binary number at BINNUM. ; The ASCII digits are changed to BCD first. Then the ; number is calculated using nesting, like this: ; NUM = {[(num1*10 + num2)*10+num3]*10+num4}*10+num5 org $2000 kbdin -- -- loop -- -- exit move.b #9, d0 trap #9 org $2100 kbdbuf dc.b '56394' ;What's the biggest we can have? org $2110 binnum ds.l 1 end
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: kbdin Solution: 2. Programming: ADDBCD.x68 (50pts) ; To add 6 packed BCD bytes (12 decimal digits) ; stored at STRING1 and STRING2 and put the ; result at STRING3. org $2000 addbcd ; Make sure that pointers point to end of each string ; of numbers, because addition is done from right to ; left. Also clear the X-flag before you start. ; Fix up loop counter too. loop ; Do the addition in a loop. -- trap #9 ; Storage areas org $8030 string1 dc.b $45,$32,$78,$97,$56,$64 org $8040 string2 dc.b $51,$56,$71,$89,$57,$28 org $8050 string3 ds.b 6 end addbcd Solution:...
View Full Document

This note was uploaded on 02/18/2010 for the course ECET 252 taught by Professor Hu during the Spring '10 term at NJIT.

Page1 / 3

HW_6_Solutions - kbdin Solution: 2. Programming: ADDBCD.x68...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online