-
Notifications
You must be signed in to change notification settings - Fork 0
/
MIN.ASM
141 lines (135 loc) · 3.23 KB
/
MIN.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
;*-----------------------------------------------------------------------------*
;*------------------------- fuzzyTECH MCU-MP V4.1 -----------------------------*
;* (c) 1995 Inform Software Corporation, 2001 Midwest Road, Oak Brook, IL60521 *
;*------------ (c) 1995 Inform GmbH, Pascalstr. 23, 52076 Aachen --------------*
;*-----------------------------------------------------------------------------*
;*-------------------- routine inference minimum for PIC16 --------------------*
;*-----------------------------------------------------------------------------*
GET_TAB MACRO
if FAMILY < 1
movf rtptr,W
call rt0
else
call rt_routine
endif
incf rtptr,F
if LARGE_RT == 1
btfsc _Z
incf rtptr+1,F
endif
ENDM
if FAMILY == 1
rt_routine
if LARGE_RT == 0
LD8PTR rt_table,rtptr
else
LD16PTR rt_table,rtptr
endif
endif
Min
IS_PAGE fuzvals
clrf rtptr
if LARGE_RT == 1
clrf rtptr+1
endif
GET_TAB
movwf rulecount
start_rule_min
if RESOLUTION == 8
movlw 0x0FF
movwf min_tmp
else
movlw 0x0FF
movwf min_tmp+0
movwf min_tmp+1
endif
GET_TAB
movwf no_i
GET_TAB
movwf no_o
cmp_min
GET_TAB
COMP_FSR
SET_PAGE
if RESOLUTION == 8
movf 0,W
else
FMOV0F16 Temp16
endif
RES_PAGE
if BANKED == 1
btfss _Z
goto cmp_min_ff
clrf min_tmp
movf no_i,W
decf rtptr,F
addwf rtptr,F
if LARGE_RT == 1
btfsc _Z
incf rtptr+1,F
endif
goto comp_min
cmp_min_ff
if FAMILY == 0
movwf save_wreg
endif
endif
if RESOLUTION == 8
subwf min_tmp,W
btfss _C
else
FCPFSLT16 Temp16,min_tmp
endif
goto next_in_min
if FAMILY == 0
if BANKED == 0
movf 0,W
movwf min_tmp
else
movf save_wreg,W
movwf min_tmp
endif
else
if RESOLUTION == 8
movf 0,W
movwf min_tmp
else
FMOV0F16 min_tmp
endif
endif
next_in_min
decfsz no_i,F
goto cmp_min
comp_min
GET_TAB
COMP_FSR
if RESOLUTION == 8
SET_PAGE
movf 0,W
RES_PAGE
subwf min_tmp,W
btfss _C
goto next_out_min
movf min_tmp,W
SET_PAGE
movwf 0
RES_PAGE
else
SET_PAGE
FMOV0F16 Temp16
RES_PAGE
FCPFSGT16 min_tmp,Temp16
goto next_out_min
SET_PAGE
FMOV16F0 min_tmp
RES_PAGE
endif
next_out_min
decfsz no_o,F
goto comp_min
decfsz rulecount,F
goto start_rule_min
if FAMILY == 1
return
endif
; The end of module inference minimum