To wind up the week that's in it, I thought a few  small Apps would be in order? I used the following Prmg routine often as 

I learned to program the Motorola 68000 microprocessor many moons ago. The 68000 was a 32-bit CISC processor and I thought it

would be interesting to compare it to the more modern ARM 32-bit RISC processor? Knowledge is comparison and it's fascinating 

to compare Cisc with Risc. In the Source Code you'll find the following "translation" of the Cisc routine in the GetRnd App. Ok, it's

a little different to an AVR program and the structure of the routine might at first seem strange to Risc machine code programmers, 

but there are still so many routines available out there on the web, which were written for Cisc processors and it would be a pity not 

to be able to recycle these resources :-) A 17Mhz Motorola Cisc versus a 72Mhz ARM Risc is really no competition and the code for the 

Risc is shorter and IMHO more elegant too, but for its time (1980), the Motorola was an advanced piece of silicon and was even used 

in Palm Pdas right upto 2005! That's part of the fun in programming in machine code ... processor comparison at the bit level, yeah!


* RND(n), 32 bit Galoise version. make n=0 for 19th next number in

* sequence or n<>0 to get 19th next number in sequence after seed n.

* This version of the PRNG uses the Galois method and a sample of

* 65536 bytes produced gives the following values.

* Entropy = 7.997442 bits per byte

* Optimum compression would reduce these 65536 bytes by 0 percent

* Chi square distribution for 65536 samples is 232.01, and

* randomly would exceed this value 75.00 percent of the time

* Arithmetic mean value of data bytes is 127.6724, 127.5 = random

* Monte Carlo value for Pi is 3.122871269, error 0.60 percent

* Serial correlation coefficient is -0.000370, uncorrelated = 0.0



            MOVEQ     #$AF-$100, D3                 * set EOR value

            MOVEQ     #18, D4                            * do this 19 times

            MOVE.L     Prng32, D0                     * get current Rng



  ADD.L     D0, D0                              * shift left 1 bit

            BCC.S Rng1                                    * branch if bit 32 not set

            EOR.B D3, D0                                 * do Galois LFSR feedback



            DBF D4, Rng0                                * loop

            MOVE.L D0, Prng32                      * save back to seed word



            DS.L 1                                         * random number store

     The second App, Cpu_Id, consists of 2 lines only and could  be  usefully employed in Denial of Access situations.

You can read the CPU ID Base Register to determine:

1:    The ID number of the processor core

2:    The Version number of the processor core

3:    The Implementation details of the processor core

  Bits           Field                            Function

[31:24]    IMPLEMENTER    Implementer code. ARM is 0x41

[23:20]    VARIANT             Implementation defined Variant number

[3:0]       REVISION            Implementation defined Revision number

    The third App, BakLit, is just a bit of fun, but then again it might also find use in many different routines :-)

U1 is an ADS7843 look-a-like, a 4-Wire Resistive Touch Screen Controller, and it outputs a logic 0 whenever

it detects a Pen Down touch on the screen. This interrupt is sent to the ARM on PortC_13 and the BakLit App

will toggle the state of the 4* Back Light Leds, which are driven by output PortC_12whenever it detects a

a negative going Pen Down Interrupt. And that's all there's to it :-)

"They do it, because they think they can."