Clear register

A

Ani

Why is it advised to used XOR operator to clear the register contents?
Why is load reg,0 not preferred.
 
Y

Yousuf Khan

Ani said:
Why is it advised to used XOR operator to clear the register contents?
Why is load reg,0 not preferred.

At one time in the olden days of x86 (circa 8086 and 80286 days, maybe
even into the 386 and 486 days), the XOR instruction executed in less
cycles than the MOV instruction. Both probably execute in 1 cycle these
days, however, the XOR instruction still takes up less space in memory
by a few bytes.

Yousuf Khan
 
P

pigdos

The 8051 has a better way than either method, at least for the Acc register.
The CLR A instruction executes faster than any other method of clearing the
Acc and uses the least amount of code memory possible.
 
K

krw

The 8051 has a better way than either method, at least for the Acc register.
The CLR A instruction executes faster than any other method of clearing the
Acc and uses the least amount of code memory possible.

True, but even that takes 12 processor cycles. At 12MHz that's
1usec. Yes folks, that's 1000 nsec. The 8051 is hardly a
"normal" processor.
 
P

pigdos

There are many variants of the 8051 (instruction set compatible) that don't
require 12 oscillator clocks for a machine cycle. For example, the obsolete
80251. What is a "normal" CPU anyway?
 
K

krw

There are many variants of the 8051

That's not what you said.
(instruction set compatible) that don't
require 12 oscillator clocks for a machine cycle.

Every one is pigdos slow. THe 8051 was never designed for speed.
For example, the obsolete
80251. What is a "normal" CPU anyway?

Von Neuman architecture is one of the measures of "normal". By
*ANY* measure the 8051 ain't normal. It ain't even normal for a
Harvard architecture processor. The instruction set is a mess.
It's *SLOW*. There are some interesting peripherals built into the
variants, but it is no way "normal" I've used it many times, and
it's an interesting product, but the ISA is a mess.
 
Y

Yousuf Khan

krw said:
Von Neuman architecture is one of the measures of "normal". By
*ANY* measure the 8051 ain't normal. It ain't even normal for a
Harvard architecture processor. The instruction set is a mess.
It's *SLOW*. There are some interesting peripherals built into the
variants, but it is no way "normal" I've used it many times, and
it's an interesting product, but the ISA is a mess.


Wasn't the 8051 the PIC (programmable interrupt controller) inside the PC?

Yousuf Khan
 
J

Joe Pfeiffer

Ani said:
Why is it advised to used XOR operator to clear the register contents?
Why is load reg,0 not preferred.

Think. You could have come up with the answer to your homework
yourself in less time than it took to post it.
 
K

krw

No. That'd be the venerable 8251...

The 8251 is/was the USART. The PC's PIC was an 8259. The keyboard
controller was an 8048 derivative, the predecessor of the 8051.
 
D

daytripper

The 8251 is/was the USART. The PC's PIC was an 8259. The keyboard
controller was an 8048 derivative, the predecessor of the 8051.

duh, yes, you're correct of course.

/daytripper (brain cramp ;-)
 
Y

Yousuf Khan

daytripper said:
duh, yes, you're correct of course.

They all start in the 8xxx range (including the processor, the 8088),
were they all Intel parts back then?

Yousuf Khan
 
D

daytripper

They all start in the 8xxx range (including the processor, the 8088),
were they all Intel parts back then?

Yousuf Khan

Yup. All full set were all in the same catalog, and Intel produced a soft
cover book detailing their internals, functions, sample code fragments to
twiddle them, and schematic implementations to hook them up...

/daytripper
 
Y

Yousuf Khan

daytripper said:
Yup. All full set were all in the same catalog, and Intel produced a soft
cover book detailing their internals, functions, sample code fragments to
twiddle them, and schematic implementations to hook them up...

So if you're saying that the 8051 was almost a general-purpose
processor, then what sort of things was it used in?

Yousuf Khan
 
S

Sebastian Kaliszewski

Ani said:
Why is it advised to used XOR operator to clear the register contents?
Why is load reg,0 not preferred.

Totay it's because mov reg, 0 takes more memory and often takes more
execution resources (on at least some CPUs eating up execution unit using
for data read access)

rgds
\SK
 
K

krw

So if you're saying that the 8051 was almost a general-purpose
processor, then what sort of things was it used in?

The 8051 is anything but a general-purpose processor. It's a
Harvard architecture (there are something like seven different
"memory spaces"), for one. It's an even crappier architecture than
the x86 for another (if you thought the x86 instructions weren't
orthogonal, check out the 51's). It's limited to 64K code and 64K
data (and that is a PITA to use). OTOH, there are likely more
8051s and derivatives in the world than any other processor. Its
market is the low-end embedded space. The 8051 derivatives have
all sorts of I/O grafted onto the basic core, from ADCs, to timers,
to PWM modulators...
 
K

krw

They all start in the 8xxx range (including the processor, the 8088),
were they all Intel parts back then?

Everything but the bus transceivers (74LS240s, IIRC), a little
glue, and the graphics controllers (the MCGA and CGA adapters used
the Motorola 6845).
 
A

Alexander Grigoriev

With Keil programming environment, you can use C to program 8051 very
conveniently. Many embedded applications fit very well to 64K.
 
K

krw

With Keil programming environment, you can use C to program 8051 very
conveniently.

C on an 80051 is an abomination, unless it's used as nothing more
than an assembler.
Many embedded applications fit very well to 64K.

That's why there are a bagillion 8051s out there, but that doesn't
make it a "general purpose processor".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top