[15] 3) The program of this exercise deals with image processing and bit manipul
ID: 3559343 • Letter: #
Question
[15] 3) The program of this exercise deals with image processing and bit manipulation. The program defines an image of 16x16 pixels entered to the memory as a 16 consecutive words each of which represent a 16-bit line of the image. The program also allocates empty storage for the results of the image manipulations performed by the three subroutines. The overall program structure should be as follows:
ORG $0900 ;start program at this address
LAB3 BSR NEG ;call subroutine negative
BSR USD ;call subroutine upside down
BSR LSR ;call subroutine left side right
BRA STOP ;stop the program
NEG ... ... ;create the negative subroutine
USD ... ... ;create the upside down subroutine
LSR ... ... ;create the left side right subroutine
ORG $0C00 ;at this address, create an image
IMAGE DC.W $0000 ;................
DC.W $0000 ;................
DC.W $3FE0 ;..111111111.....
DC.W $3FF0 ;..1111111111....
DC.W $3878 ;..111....1111...
DC.W $3838 ;..111.....111...
DC.W $3838 ;..111.....111...
DC.W $3870 ;..111....111....
DC.W $3FE0 ;..111111111.....
DC.W $3FE0 ;..111111111.....
DC.W $3870 ;..111....111....
DC.W $3870 ;..111....111....
DC.W $3838 ;..111.....111...
DC.W $3838 ;..111.....111...
DC.W $0000 ;................
DC.W $0000 ;................
DC.L $COCOCOCO ;a marker at the end of original image
ORG $0C40 ;at this address
IM-NEG DS.W 16 ;allocate space for negative image
DC.L $C4C4C4C4 ;a marker at the end of negative image
ORG $0C80 ;at this address
IM-USD DS.W 16 ;allocate space for upside down image
DC.L $C8C8C8C8 ;a marker at the end of flipped image
ORG $0CC0 ;at this address
IM-LSR DS.W 16 ;allocate space for left side right
DC.L $CCCCCCCC ;a marker at the end of rotated image
STOP MOVE.B #228,D7
TRAP #14
END
[5] 3.a) Complete the above 68000 assembly language program by creating the three subroutines. The NEG subroutine computes the negative form of the original image and stores it in the allocated space. The USD subroutine rotates the original image left side right and stores it in the allocated space. The LSR subroutine flips the original image upside down and stores it in the allocated space.
[5] 3.b) Run your program and compare the results obtained from memory with those computed by hand. All of these numbers should be in hex.
IMAGE from program =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-NEG from program =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-NEG by hand =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-USD from program =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-USD by hand =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-LSR from program =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
IM-LSR by hand =
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
[5] 3.c) Create a new subroutine which adds a frame to the original image. The frame is formed by making the most outer surrounding bits of the original image all 1
Explanation / Answer
Complete the above 68000 assembly language program by creating the three subroutines.
IMNEG DC.W $ffff ;1111111111111111
DC.W $ffff ;1111111111111111
DC.W $c01f ;11.........11111
DC.W $c00f ;11..........1111
DC.W $c787 ;11...1111....111
...
...
DC.W $c7c7 ;11...11111...111
DC.W $c7c7 ;11...11111...111
DC.W $0000 ;1111111111111111
DC.W $0000 ;1111111111111111
DC.L $C4C4C4C4 ;a marker at the end of neg. image
IMUSD DC.W $0000 ;................
DC.W $0000 ;................
DC.W $3838 ;..111.....111...
DC.W $3838 ;..111.....111...
DC.W $3870 ;..111....111....
DC.W $3870 ;..111....111....
...
...
DC.W $3838 ;..111.....111...
DC.W $3878 ;..111....1111...
DC.W $3FF0 ;..1111111111....
DC.W $3FE0 ;..111111111.....
DC.W $0000 ;................
DC.W $0000 ;................
DC.L $C8C8C8C8 ;a marker at the end of image
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.