001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161 | ;********************** Dissolve **********************
cblock h'38'
dis_lp
dis_bit
dis_row
dis_datas
dis_dataw
dis_work1
dis_work2
endc
scrnchd equ h'40'
dissolve
movlw d'16' ;Set loop count
movwf dis_lp ;Save loop count
movlw scrnchd ;Set screen check head
movwf dis_work1 ;Save check address
dis_lp1 movf dis_work1,w ;Read check address
movwf fsr ;Set check address
movlw b'01111111' ;Set init bit pattern
movwf indf ;Write bit pattern
incf dis_work1,f ;Check addres + 1
decfsz dis_lp,f ;Initial end ?
goto dis_lp1 ;Next
movlw d'112' ;Set loop count
movwf dis_lp ;Save loop count
dis_loop
movf tmr0,w ;Read Random Number
movwf dis_row ;Save random number
movwf dis_bit ;Save random number
movlw b'00000111' ;Set mask pattern
andwf dis_bit,f ;Pick-up bit ID
btfsc status,z ;Bit ID = 0 ?
incf dis_bit,f ;Yes. Bit ID + 1
movlw d'3' ;Set shift count
movwf dis_work1 ;Save shift count
dis_sf_lp
rrf dis_row,f ;Rotate right
decfsz dis_work1,f ;Rotate end ?
goto dis_sf_lp ;No. Next
movlw b'00001111' ;Set mask pattern
andwf dis_row,f ;Pick-up row ID
dis_row_proc
movlw scrnchd ;Set check head adr
addwf dis_row,w ;Set check adr
movwf fsr ;Set check adr
movf indf,w ;Read check data
movwf dis_work1 ;Save check data
btfsc status,z ;All 0 ?(Processed?)
goto dis_other_row ;Yes. Set other row
dis_bit_proc
movf dis_bit,w ;Set bit ID
movwf dis_work2 ;Save bit ID
dis_lp2 rrf dis_work1,f ;Rotate right
decfsz dis_work2,f ;Rotate end ?
goto dis_lp2 ;No. Next
btfss status,c ;Bit = 0 ?(Processed?)
goto dis_other_bit ;Yes. Set other bit
bcf status,c ;Clear bit
movwf dis_work2 ;Save bit ID
dis_lp3 rlf dis_work1,f ;Rotate left
decfsz dis_work2,f ;Rotate end ?
goto dis_lp3 ;No. Next
movlw scrnchd ;Set check head adr
addwf dis_row,w ;Set check adr
movwf fsr ;Set check adr
movf dis_work1,w ;Read check data
movwf indf ;Write check data
movlw scrnhd ;Set screen head adr
addwf dis_row,w ;Set screen adr
movwf fsr ;Set screen adr
movf indf,w ;Read screen data
movwf dis_datas ;Save screen data
movf dis_bit,w ;Set bit ID
movwf dis_work2 ;Save bit ID
decfsz dis_work2,f ;Need shift ?
goto dis_lp4 ;Yes. Shift proc
dis_aa bcf dis_datas,0 ;Clear bit
movwf dis_work2 ;Save bit ID
decfsz dis_work2,f ;Need shift ?
goto dis_lp5 ;Yes. Shift proc
dis_bb movlw scrnwhd ;Set screen work H.A
addwf dis_row,w ;Set screen work adr
movwf fsr ;Set screen work adr
movf indf,w ;Read screen work data
movwf dis_dataw ;Save work data
movf dis_bit,w ;Set bit ID
movwf dis_work2 ;Save bit ID
decfsz dis_work2,f ;Need shift ?
goto dis_lp6 ;Yes. Shift proc
dis_cc movlw b'00000001' ;Set mask pattern
andwf dis_dataw,f ;Pick-up data
bcf status,c ;Clear carry bit
movf dis_bit,w ;Set bit ID
movwf dis_work2 ;Save bit ID
decfsz dis_work2,f ;Need shift ?
goto dis_lp7 ;Yes. Shift proc
dis_dd movf dis_dataw,w ;Read picked work data
iorwf dis_datas,f ;Set data
movlw scrnhd ;Set screen head adr
addwf dis_row,w ;Set screen adr
movwf fsr ;Set screen adr
movf dis_datas,w ;Set data
movwf indf ;Write data
call led_cnt ;LED control
call t100m ;Wait 100 msec
decfsz dis_lp,f ;Loop end ?
goto dis_loop ;No. Next
return
dis_lp4 rrf dis_datas,f ;Rotate right
decfsz dis_work2,f ;Rotate end ?
goto dis_lp4 ;No. Next
goto dis_aa
dis_lp5 rlf dis_datas,f ;Rotate left
decfsz dis_work2,f ;Rotate end ?
goto dis_lp5 ;No. Next
goto dis_bb
dis_lp6 rrf dis_dataw,f ;Rotate right
decfsz dis_work2,f ;Rotate end ?
goto dis_lp6 ;No. Next
goto dis_cc
dis_lp7 rlf dis_dataw,f ;Rotate left
decfsz dis_work2,f ;Rotate end ?
goto dis_lp7 ;No. Next
goto dis_dd
dis_other_row
movf dis_row,w ;Read row ID
btfsc status,z ;Row ID = 0 ?
movlw d'16' ;Set max row ID
movwf dis_row ;Save row ID
decf dis_row,f ;Row ID - 1
movlw scrnchd ;Set check head adr
addwf dis_row,w ;Set check adr
movwf fsr ;Set check adr
movf indf,w ;Read check data
movwf dis_work1 ;Save check data
goto dis_row_proc
dis_other_bit
decf dis_bit,f ;Bit ID - 1
movf dis_bit,w ;Read bit ID
btfsc status,z ;Bit ID = 0 ?
movlw d'7' ;Yes. Set max bit ID
movwf dis_bit ;Save bit ID
movlw scrnchd ;Set check head adr
addwf dis_row,w ;Set check adr
movwf fsr ;Set check adr
movf indf,w ;Read check data
movwf dis_work1 ;Save check data
goto dis_bit_proc |