              ; simple memory test - runs test patterns through off-chip RAM
              ;
              ; written by Quinn Jensen (jensenq@qcj.icon.com)
              ;
              
              include "ioequ.inc"
              
              
              
000000        start   equ     $0000
00FF00        length  equ     $ff00
              
P:0000                org     p:$0000
P:0000 0AF080         jmp     begin
P:0001 000040
              
P:0040                org     p:$40
P:0040        begin
P:0040 08F4BE         movep   #$0f0f,x:m_bcr  ;wait states
P:0041 000F0F
P:0042 08F4A0         movep   #0,x:m_pbc      ;port B: parallel I/O
P:0043 000000
P:0044 08F4A2         movep   #-1,x:m_pbddr   ;port B: all output
P:0045 FFFFFF
P:0046 08F4A4          movep  #($1)<<7,x:m_pbd
P:0047 000080
P:0048 08F4A4          movep  #($1|3<<4)<<7,x:m_pbd           ;clear strobes
P:0049 001880
              
P:004A        loop
P:004A 44F400         move    #>$000000,x0    ;pattern
P:004B 000000
P:004C 0D007C         jsr     <dopat
P:004D 44F400         move    #>$AAAAAA,x0    ;pattern
P:004E AAAAAA
P:004F 0D007C         jsr     <dopat
P:0050 0D0064         jsr     <iatest
P:0051 44F400         move    #>$555555,x0    ;pattern
P:0052 555555
P:0053 0D007C         jsr     <dopat
P:0054 0D0064         jsr     <iatest
P:0055 44F400         move    #>$FFFFFF,x0    ;pattern
P:0056 FFFFFF
P:0057 0D007C         jsr     <dopat
P:0058 44F400         move    #>$DEADEE,x0    ;pattern
P:0059 DEADEE
P:005A 0D007C         jsr     <dopat
P:005B 0D0064         jsr     <iatest
P:005C 44F400         move    #>$123456,x0    ;pattern
P:005D 123456
P:005E 0D007C         jsr     <dopat
P:005F 44F400         move    #>$876543,x0    ;pattern
P:0060 876543
P:0061 0D007C         jsr     <dopat
P:0062 0D0064         jsr     <iatest
P:0063 0C004A         jmp     <loop
              
P:0064        iatest
P:0064 2E1A00         move    #$1a,a
P:0065 0D00A6         jsr     <disp           ;show which test
P:0066 60F400         move    #start,r0
P:0067 000000
P:0068 45F400         move    #length,x1
P:0069 00FF00
P:006A 06C500         do      x1,iafill
P:006B 00006E
P:006C 220E00         move    r0,a
P:006D 200017         not     a
P:006E 565800         move    a,x:(r0)+
P:006F        iafill
P:006F 60F400         move    #start,r0
P:0070 000000
P:0071 45F400         move    #length,x1
P:0072 00FF00
P:0073 06C500         do      x1,iacheck
P:0074 00007A
P:0075 54D800         move    x:(r0)+,a1
P:0076 220F00         move    r0,b
P:0077 20001F         not     b
P:0078 21E400         move    b,x0
P:0079 200043         eor     x0,a
P:007A 0E2093         jne     <error
P:007B        iacheck
              
P:007B 00000C         rts
              
P:007C        dopat
P:007C 209F00         move    x0,n7
P:007D 208E00         move    x0,a
P:007E 0D00A6         jsr     <disp           ;show which pattern
P:007F 23E400         move    n7,x0
P:0080 45F400         move    #length,x1
P:0081 00FF00
P:0082 0D0085         jsr     <patfill
P:0083 0D008B         jsr     <patcheck
P:0084 00000C         rts
              
P:0085        patfill
P:0085 60F400         move    #start,r0
P:0086 000000
P:0087 06C500         do      x1,lfill
P:0088 000089
P:0089 445800         move    x0,x:(r0)+
P:008A        lfill
P:008A 00000C         rts
              
P:008B        patcheck
P:008B 60F400         move    #start,r0
P:008C 000000
P:008D 06C500         do      x1,lcheck
P:008E 000091
P:008F 54D800         move    x:(r0)+,a1
P:0090 200043         eor     x0,a
P:0091 0E2093         jne     <error
P:0092        lcheck
P:0092 00000C         rts
              
00012C        blink1  equ     300
000FA0        blink2  equ     4000
              
P:0093        error
P:0093 208C00         move    x0,a1
P:0094 0D00A6         jsr     <disp           ;display error code
P:0095        eloop
P:0095 0A700D         bclr    #13,x:m_pbd
P:0096 00FFE4
P:0097 0A700E         bclr    #14,x:m_pbd
P:0098 00FFE4
P:0099 062C81         do      #blink1,el1
P:009A 00009C
P:009B 06A0AF         rep     #blink2
P:009C 000000         nop
P:009D        el1
P:009D 0A702D         bset    #13,x:m_pbd
P:009E 00FFE4
P:009F 0A702E         bset    #14,x:m_pbd
P:00A0 00FFE4
P:00A1 062C81         do      #blink1,el2
P:00A2 0000A4
P:00A3 06A0AF         rep     #blink2
P:00A4 000000         nop
P:00A5        el2
P:00A5 0C0095         jmp     <eloop
              
              include "disp.a56"

Summary of psect usage

                 section seg base last top      used       avail    total
-------------------------------------------------------------------------


Symbol Table
-------------------------------------
            loop 00004A
           begin 000040
           start 000000
         iacheck 00007B
          iafill 00006F
          iatest 000064
             el2 0000A5
             el1 00009D
           eloop 000095
          length 00FF00
           lfill 00008A
           dopat 00007C
            disp 0000A6
          blink2 000FA0
          blink1 00012C
          lcheck 000092
        patcheck 00008B
         patfill 000085
           error 000093
          m_scl1 00000F
          m_scl0 00000E
           m_scl 00C000
          m_ssl1 00000D
          m_ssl0 00000C
           m_ssl 003000
          m_hpl1 00000B
          m_hpl0 00000A
           m_hpl 000C00
          m_ibl2 000005
          m_ibl1 000004
          m_ibl0 000003
           m_ibl 000038
          m_ial2 000002
          m_ial1 000001
          m_ial0 000000
           m_ial 000007
           m_ipr 00FFFF
           m_rdf 000007
           m_tde 000006
           m_roe 000005
           m_tue 000004
           m_rfs 000003
           m_tfs 000002
           m_if1 000001
           m_if0 000000
            m_if 000002
          m_srie 00000F
          m_stie 00000E
           m_sre 00000D
           m_ste 00000C
           m_mod 00000B
           m_gck 00000A
           m_syn 000009
           m_fsl 000008
          m_sckd 000005
          m_scd2 000004
          m_scd1 000003
          m_scd0 000002
           m_scd 00001C
           m_of1 000001
           m_of0 000000
            m_of 000003
           m_psr 00000F
           m_wl1 00000E
           m_wl0 00000D
            m_wl 006000
            m_dc 001F00
            m_pm 0000FF
           m_tsr 00FFEE
            m_sr 00FFEE
           m_crb 00FFED
           m_cra 00FFEC
            m_tx 00FFEF
            m_rx 00FFEF
           m_tcm 00000F
           m_rcm 00000E
           m_scp 00000D
           m_cod 00000C
            m_cd 000FFF
            m_r8 000007
            m_fe 000006
            m_pe 000005
            m_or 000004
          m_idle 000003
          m_rdrf 000002
          m_tdre 000001
          m_trne 000000
          m_tmie 00000D
           m_tie 00000C
           m_rie 00000B
          m_ilie 00000A
            m_te 000009
            m_re 000008
          m_woms 000007
           m_rwi 000006
          m_wake 000005
           m_sbk 000004
          m_wds2 000002
          m_wds1 000001
          m_wds0 000000
           m_wds 000003
          m_sccr 00FFF2
           m_ssr 00FFF1
           m_scr 00FFF0
          m_stxa 00FFF3
          m_stxh 00FFF6
          m_stxm 00FFF5
          m_stxl 00FFF4
          m_srxh 00FFF6
          m_srxm 00FFF5
          m_srxl 00FFF4
           m_dma 000007
           m_hf1 000004
           m_hf0 000003
            m_hf 000018
           m_hcp 000002
          m_htde 000001
          m_hrdf 000000
           m_hf3 000004
           m_hf2 000003
          m_hcie 000002
          m_htie 000001
          m_hrie 000000
           m_htx 00FFEB
           m_hrx 00FFEB
           m_hsr 00FFE9
           m_hcr 00FFE8
           m_pcd 00FFE5
         m_pcddr 00FFE3
           m_pcc 00FFE1
           m_pbd 00FFE4
         m_pbddr 00FFE2
           m_pbc 00FFE0
           m_bcr 00FFFE
errors=0
