CRC_CCITT 16-bit assembly language code

You don't need to worry about the zeroes, as they are typically part of the data, even if they are not part of the message. For example you are processing one word at a time, so if there is only one bit data in it there will be 31 zeroes in the word.

I'd test it a bit more before calling it finished... I found at least 3 mistakes in it that will cause it to fail in various ways. Apart from that you could speed it up a lot by removing all the redundant instructions. As I said before, it would be best to start with C, as you'd get much smaller and faster code that way.

Wilco

Reply to
Wilco Dijkstra
Loading thread data ...

news:8IadnVeJarjGubvanZ2dnUVZ snipped-for-privacy@giganews.com...

to

there

and

specific

mistakes in

speed it

would

way.

Read the article by Joe Geluso about appending zeroes and also read th CRC_CCITT specifications document. Zeroes have nothing to do with data.

my code as i said is application specific. Also i don't need to start wit C as there is a lot of good code already written in C that is free for al to use. Why would anybody want to develop source code in C from scratc when there's superfast crc code already splattered across websites al over the world?

My code spits out the right answer for data ranging from 1 byte to as man words in any permutation and combination (for example 2 words and 1 byte as i possibly require for my application. My application will never have single bit data so it does not interest to me pursue those avenues.

State those 3 mistakes instead of just making a blank statement and als state the redundant instructions.

Undoubtedly the code can be speeded up.

Only make statements if you have concrete "assembly language " code t support your statements.

Vy

Reply to
Vy

There are lots of ways of appending zeroes, but few would put code to do this in the middle of the inner loop...

So why don't you use it then? Assembler is really only necessary if you can't get the required performance from C.

If you only process bytes then any of the routines posted would be fine.

I'd like you to have a good look at the code yourself. For example, the code enters an infinite loop if you call crc_16 with R3 = 8 or 16. With R3 = 24 or 32 the code simply ignores the given data and enters the zero bit loop instead. It corrupts bit 0 of the CRC when it returns. Finally it uses various registers without saving/restoring them, so if you call the routine from C the application will crash.

Wilco

Reply to
Wilco Dijkstra

news:ZuydnTetNLdhxLvanZ2dnUVZ snipped-for-privacy@giganews.com...

the

data.

with

all

scratch

many

byte)

have a

also

code

24 or 32

instead.

registers

application

thanks !!!

Reply to
Vy

Why not use a lookup table? Like:

formatting link

What is driving assembly language? The table solution is FAST--if you have sufficient memory.

Bo

Reply to
Bo

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.