Write a Program to Perform Signed Division of Two Bytes writ

Write a Program to Perform Signed Division of Two Bytes. write a code which will carry out signed division of byteA by byteB.Your code is required to use input variables byteA and byteB and output variable byteQ and byteR.

where, byteA=byteQ*byteB+byteR,         (byteB is non-zero)

Step 1 Determine absolute value of byteA and byteB (for negative numbers compute complement +1 of each byte using COMF (complement) and INCF (increment) instructions.

Step 2: Divide abs( byteA)/abs(byteB) using the sample file

Step3: Check signs

if byteA>0, byteB<0, byteQ=-byteQ (use COMF + INCF), byteR= unchanged

if byteA<0, byteB>0, byteQ=-byteQ (use COMF + INCF), byteR= -byteR (use COMF + INCF)

if byteA<0, byteB<0, byteQ=byteQ, byteR= -byteR (use COMF + INCF),

if byteA>0, byteB>0, no change - done

The results should be coded as positive/negative numbers. Make sure to check your code using the simulator/debugger feature of MPLAB IDE X

Solution

The \"escape\" format is the traditional PostgreSQL format for the bytea type. It takes the approach of representing a binary string as a sequence of ASCII characters, while converting those bytes that cannot be represented as an ASCII character into special escape sequences. If, from the point of view of the application, representing bytes as characters makes sense, then this representation can be convenient. But in practice it is usually confusing because it fuzzes up the distinction between binary strings and character strings, and also the particular escape mechanism that was chosen is somewhat unwieldy. So this format should probably be avoided for most new applications.

When entering bytea values in escape format, octets of certain values must be escaped, while all octet values can be escaped. In general, to escape an octet, convert it into its three-digit octal value and precede it by a backslash (or two backslashes, if writing the value as a literal using escape string syntax). Backslash itself (octet value 92) can alternatively be represented by double backslashes. Table 8-7 shows the characters that must be escaped, and gives the alternative escape sequences where applicable.

Table 8-7. bytea Literal Escaped Octets

Decimal Octet Value Description Escaped Input Representation Example Output Representation
0 zero octet E\'\\\\000\' SELECT E\'\\\\000\'::bytea; \\000
39 single quote \'\'\'\' or E\'\\\\047\' SELECT E\'\\\'\'::bytea; \'
92 backslash E\'\\\\\\\\\' or E\'\\\\134\' SELECT E\'\\\\\\\\\'::bytea; \\\\
0 to 31 and 127 to 255 \"non-printable\" octets E\'\\\\xxx\' (octal value) SELECT E\'\\\\001\'::bytea; \\001
Write a Program to Perform Signed Division of Two Bytes. write a code which will carry out signed division of byteA by byteB.Your code is required to use input

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site