On Mon, 1 Nov 2004, EECS 382 student wrote: > Prof Wolff, > > > > Sorry to bother you again, but I was talking with one of the other students > in the class and we aren't sure of one thing. > > In the Java Assembly is R1 supposed to be a byte, a char, or something else? > Right now we are using java code like this: > > void main() { > > char R1=136; Remember that the char here is for the C language. The Java char is uni-code 16 bits, byte is 8 bits. The C language does have a wide character but the char here is a byte because the 8051's smallest useful register size is 8-bits. > > short DPTR; > > DPTR=(short) (R1+200+4096); An 8-bit char must translate to a "byte" data type in JAVA. So, getting there. First of all, hint, all compilers fold their constants into a single value. There is still another way to cast. But this "take home" is not intended to be java/c perfect on casting. And no need to convert the constant to decimal, what is it's 16-bit hexidecimal value? > > } > > > > And from that converting it into Assembly code. Which converts easily, but > if we use byte it is much more difficult for a number of reasons, the least > of which is that 136 won't fit in a byte. Any help your willing to give > would help. Trick the compiler: If the sign bit is one, is it positive or negative? and work from there. You should be able to just look up the JVM codes to write the assembly, it is optional to write to actually compile it. As long as you understand the JVM instruction codes actually do. --frank.