#define CONST_A 0x0400
#define CONST_B 0x0c0
void main( void )
{
unsigned char x0;
unsigned int y0;
x0 = 0x090;
y0 = ( x0 * CONST_A ) / CONST_B;
}
When I declare the function (void_far) type, a 4-byte area is reserved for this. Why isn't a 3-byte area (0 - FFFFFFH)
reserved? (Aug. 25, 2000)
●
I defined a numerical value for the character string by the "#define" preprocess command. However, the operation of this
expression using this string did not result in the expected value. Why not?
In the following example, operation 'cul' does not result in the expected value, 0x04AAAA. (Aug. 25, 2000) [Program Example]
#define V1 0x040000
#define V2 0x0AAAA + V1
cul = (WORD *)v2
●
When NC30 compiles a signed variable left-shift statement, it uses a logical shift instruction instead of an arithmetic shift
instruction. Why is that? (Jul. 21, 2000)
●
When I define an interrupt function with "#pragma INTERRUPT/B", the compiler does not generate any "fclrB" instruction
for register switching. Why is that? (Jul. 21, 2000)
●
How are the following operations are handled in NC30? (Mar. 21, 2000)
Rounding direction of negative integer division "/" result.1.
Sign of negative integer remainder "%" result.2.
Does negative integer right-shift ">>" result make arithmetic shift (sign bit stuffing in MSB) or logical shift (0 stuffed
in MSB)?
3.
●
In the example program, why does the right side of the equation [aaa = (signed long)( BBB << CCC );] become 0x0000f000?
When I use VISUAL C++, it becomes 0x0ffff000. (Mar. 21, 2000)
Example program Compiled assembly code
#define BBB (unsigned short)0xffff
#define CCC (unsigned char)12
signed long aaa;
test( void )
{
aaa = (signed long)( BBB << CCC );
}
_test:
mov.w #0f000H,_aaa
mov.w #00000H,_aaa+2
rts
●
In the program example, variable b is over written at the line stated by [l=ReceiveByte(4);] in the compiled assembly code.
Why does this happen? (Mar. 21, 2000)
Example program Assembly code
●
Kommentare zu diesen Handbüchern