; ECE331 White Noise ; PRBS.ASM - Generates 2^31-1 bit long PRBS (pseudorandom binary sequence with ; a 15.625 kHz clock rate). Uses RTI interrupt. ; XDEF WHITENOISE ABSENTRY WHITENOISE INCLUDE 'mc9s12c32.inc' ORG $3800 SHR3: ds.b 1 SHR2: ds.b 1 SHR1: ds.b 1 SHR0: ds.b 1 TEMP: ds.b 1 ORG $4000 WHITENOISE: lds #$3f00 bset DDRM,1 ;Make PM0 a digital output. bclr PTM,1 ;Lower PM0 movw #$FFFF,SHR3 ;Initialize Shift Reg to all 1's movw #$FFFF,SHR1 movb #%00010000,RTICTL ;Divide 16MHZ OSCCLK by 1*2^10 ;RTI interrupts at 15.625 kHz rate bset CRGINT,%10000000 ;Locally Enable RTI interrupts movb #$80,CRGFLG ;Clear RTI interrupt flag cli ;globally enable interrupts loop_here_forever: bra loop_here_forever ;*********Here ends the main program "WHITENOISE" WHITENOISEISR: CLR TEMP BRCLR SHR3,%00100000,FF2NOTSET MOVB #1,TEMP FF2NOTSET: CLRA BRCLR SHR0,%00000010,FF30NOTSET LDAA #1 FF30NOTSET: EORA TEMP RORA ROR SHR3 ROR SHR2 ROR SHR1 ROR SHR0 movb #$80,CRGFLG ;Relax the RTI interrupt flag ldaa SHR0 rora STAA PTM ;Send Bit #30 out to PM0 rti ;************************************************************** ;* Initialize Reset Vector and TC6 Interrupt Vector * ;************************************************************** ORG $FFFE fdb WHITENOISE ;Make reset vector point to entry point of WHITENOISE program ORG $FFF0 fdb WHITENOISEISR ;Make RTI interrupt vector point to RTI interrupt rtn