~arcachofo/simulide/1.1.0

« back to all changes in this revision

Viewing changes to resources/examples/Pic/glcd8544_p18f2550/glcd8544_p18f2550.asm

  • Committer: arcachofo
  • Date: 2021-01-01 14:23:42 UTC
  • Revision ID: arcachofo@simulide.com-20210101142342-ozfljnll44g5lbl3
Initial Commit 0.5.15-RC3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;Program compiled by Great Cow BASIC (0.94 2015-10-27)
 
2
;Need help? See the GCBASIC forums at http://sourceforge.net/projects/gcbasic/forums,
 
3
;check the documentation or email w_cholmondeley at users dot sourceforge dot net.
 
4
 
 
5
;********************************************************************************
 
6
 
 
7
;Set up the assembler options (Chip type, clock source, other bits and pieces)
 
8
 LIST p=18F2550, r=DEC
 
9
#include <P18F2550.inc>
 
10
 CONFIG LVP = OFF, MCLRE = OFF, WDT = OFF, FOSC = HS
 
11
 
 
12
;********************************************************************************
 
13
 
 
14
;Set aside memory locations for variables
 
15
DELAYTEMP       EQU     0
 
16
DELAYTEMP2      EQU     1
 
17
SYSCALCTEMPA    EQU     5
 
18
SYSSTRINGLENGTH EQU     6
 
19
SysStringA      EQU     7
 
20
SysStringA_H    EQU     8
 
21
SysWaitTempMS   EQU     2
 
22
SysWaitTempMS_H EQU     3
 
23
SysWaitTempS    EQU     4
 
24
SysWaitTempUS   EQU     5
 
25
SysWaitTempUS_H EQU     6
 
26
SYSSTRINGPARAM1 EQU     2006
 
27
CC_X    EQU     9
 
28
CHARLINE        EQU     10
 
29
C_X     EQU     11
 
30
C_Y     EQU     12
 
31
DISPLAY EQU     13
 
32
D_X     EQU     14
 
33
D_Y     EQU     15
 
34
GLCDCHAR        EQU     16
 
35
GLCDCOMDAT      EQU     17
 
36
GLCDDAT EQU     18
 
37
GLCDINDEX       EQU     19
 
38
GLCDP_X EQU     20
 
39
GLCDP_Y EQU     21
 
40
PRINTLEN        EQU     22
 
41
SERDATA EQU     23
 
42
SYSPRINTTEMP    EQU     24
 
43
StringPointer   EQU     25
 
44
SysGLCDSTRDATHandler    EQU     26
 
45
SysGLCDSTRDATHandler_H  EQU     27
 
46
SysPRINTDATAHandler     EQU     28
 
47
SysPRINTDATAHandler_H   EQU     29
 
48
SysRepeatTemp1  EQU     30
 
49
SysRepeatTemp2  EQU     31
 
50
SysRepeatTemp3  EQU     32
 
51
SysRepeatTemp3_H        EQU     33
 
52
SysRepeatTemp4  EQU     34
 
53
SysTemp1        EQU     35
 
54
 
 
55
;********************************************************************************
 
56
 
 
57
;Alias variables
 
58
AFSR0   EQU     4073
 
59
AFSR0_H EQU     4074
 
60
 
 
61
;********************************************************************************
 
62
 
 
63
;Vectors
 
64
        ORG     0
 
65
        goto    BASPROGRAMSTART
 
66
        ORG     8
 
67
        retfie
 
68
 
 
69
;********************************************************************************
 
70
 
 
71
;Start of program memory page 0
 
72
        ORG     12
 
73
BASPROGRAMSTART
 
74
;Call initialisation routines
 
75
        rcall   INITSYS
 
76
        rcall   INITUSART
 
77
;Automatic pin direction setting
 
78
        bcf     TRISB,7,ACCESS
 
79
        bcf     TRISB,6,ACCESS
 
80
        bcf     TRISB,5,ACCESS
 
81
        bcf     TRISB,4,ACCESS
 
82
        bcf     TRISB,3,ACCESS
 
83
        bcf     TRISB,2,ACCESS
 
84
        bcf     TRISB,0,ACCESS
 
85
 
 
86
;Start of the main program
 
87
        bcf     LATB,3,ACCESS
 
88
        bcf     LATB,2,ACCESS
 
89
        rcall   INITGLCD
 
90
        movlw   3
 
91
        movwf   SysRepeatTemp1,BANKED
 
92
SysRepeatLoop1
 
93
        bcf     LATB,3,ACCESS
 
94
        bsf     LATB,2,ACCESS
 
95
        movlw   1
 
96
        movwf   DISPLAY,BANKED
 
97
        lfsr    1,SYSSTRINGPARAM1
 
98
        movlw   low StringTable5
 
99
        movwf   TBLPTRL,ACCESS
 
100
        movlw   high StringTable5
 
101
        movwf   TBLPTRH,ACCESS
 
102
        rcall   SysReadString
 
103
        movlw   low SYSSTRINGPARAM1
 
104
        movwf   SysPRINTDATAHandler,BANKED
 
105
        movlw   high SYSSTRINGPARAM1
 
106
        movwf   SysPRINTDATAHandler_H,BANKED
 
107
        rcall   HSERPRINT125
 
108
        movlw   10
 
109
        movwf   SERDATA,BANKED
 
110
        rcall   HSERSEND
 
111
        rcall   GLCDCLEAR
 
112
        movlw   244
 
113
        movwf   SysWaitTempMS,ACCESS
 
114
        movlw   1
 
115
        movwf   SysWaitTempMS_H,ACCESS
 
116
        rcall   Delay_MS
 
117
        bsf     LATB,3,ACCESS
 
118
        bcf     LATB,2,ACCESS
 
119
        movlw   2
 
120
        movwf   DISPLAY,BANKED
 
121
        lfsr    1,SYSSTRINGPARAM1
 
122
        movlw   low StringTable6
 
123
        movwf   TBLPTRL,ACCESS
 
124
        movlw   high StringTable6
 
125
        movwf   TBLPTRH,ACCESS
 
126
        rcall   SysReadString
 
127
        movlw   low SYSSTRINGPARAM1
 
128
        movwf   SysPRINTDATAHandler,BANKED
 
129
        movlw   high SYSSTRINGPARAM1
 
130
        movwf   SysPRINTDATAHandler_H,BANKED
 
131
        rcall   HSERPRINT125
 
132
        movlw   10
 
133
        movwf   SERDATA,BANKED
 
134
        rcall   HSERSEND
 
135
        rcall   GLCDCLEAR
 
136
        movlw   244
 
137
        movwf   SysWaitTempMS,ACCESS
 
138
        movlw   1
 
139
        movwf   SysWaitTempMS_H,ACCESS
 
140
        rcall   Delay_MS
 
141
        bcf     LATB,3,ACCESS
 
142
        bsf     LATB,2,ACCESS
 
143
        movlw   1
 
144
        movwf   DISPLAY,BANKED
 
145
        lfsr    1,SYSSTRINGPARAM1
 
146
        movlw   low StringTable5
 
147
        movwf   TBLPTRL,ACCESS
 
148
        movlw   high StringTable5
 
149
        movwf   TBLPTRH,ACCESS
 
150
        rcall   SysReadString
 
151
        movlw   low SYSSTRINGPARAM1
 
152
        movwf   SysPRINTDATAHandler,BANKED
 
153
        movlw   high SYSSTRINGPARAM1
 
154
        movwf   SysPRINTDATAHandler_H,BANKED
 
155
        rcall   HSERPRINT125
 
156
        movlw   10
 
157
        movwf   SERDATA,BANKED
 
158
        rcall   HSERSEND
 
159
        rcall   GLCDCLEAR
 
160
        rcall   GLCDDRAWFRAME
 
161
        movlw   1
 
162
        movwf   GLCDP_X,BANKED
 
163
        movlw   1
 
164
        movwf   GLCDP_Y,BANKED
 
165
        rcall   GLCDGOTOXY
 
166
        lfsr    1,SYSSTRINGPARAM1
 
167
        movlw   low StringTable1
 
168
        movwf   TBLPTRL,ACCESS
 
169
        movlw   high StringTable1
 
170
        movwf   TBLPTRH,ACCESS
 
171
        rcall   SysReadString
 
172
        movlw   low SYSSTRINGPARAM1
 
173
        movwf   SysGLCDSTRDATHandler,BANKED
 
174
        movlw   high SYSSTRINGPARAM1
 
175
        movwf   SysGLCDSTRDATHandler_H,BANKED
 
176
        rcall   GLCDPRINT9
 
177
        movlw   244
 
178
        movwf   SysWaitTempMS,ACCESS
 
179
        movlw   1
 
180
        movwf   SysWaitTempMS_H,ACCESS
 
181
        rcall   Delay_MS
 
182
        bsf     LATB,3,ACCESS
 
183
        bcf     LATB,2,ACCESS
 
184
        movlw   2
 
185
        movwf   DISPLAY,BANKED
 
186
        lfsr    1,SYSSTRINGPARAM1
 
187
        movlw   low StringTable6
 
188
        movwf   TBLPTRL,ACCESS
 
189
        movlw   high StringTable6
 
190
        movwf   TBLPTRH,ACCESS
 
191
        rcall   SysReadString
 
192
        movlw   low SYSSTRINGPARAM1
 
193
        movwf   SysPRINTDATAHandler,BANKED
 
194
        movlw   high SYSSTRINGPARAM1
 
195
        movwf   SysPRINTDATAHandler_H,BANKED
 
196
        rcall   HSERPRINT125
 
197
        movlw   10
 
198
        movwf   SERDATA,BANKED
 
199
        rcall   HSERSEND
 
200
        rcall   GLCDCLEAR
 
201
        rcall   GLCDDRAWFRAME
 
202
        rcall   GLCDDRAWFRAME
 
203
        movlw   1
 
204
        movwf   GLCDP_X,BANKED
 
205
        movlw   1
 
206
        movwf   GLCDP_Y,BANKED
 
207
        rcall   GLCDGOTOXY
 
208
        lfsr    1,SYSSTRINGPARAM1
 
209
        movlw   low StringTable2
 
210
        movwf   TBLPTRL,ACCESS
 
211
        movlw   high StringTable2
 
212
        movwf   TBLPTRH,ACCESS
 
213
        rcall   SysReadString
 
214
        movlw   low SYSSTRINGPARAM1
 
215
        movwf   SysGLCDSTRDATHandler,BANKED
 
216
        movlw   high SYSSTRINGPARAM1
 
217
        movwf   SysGLCDSTRDATHandler_H,BANKED
 
218
        rcall   GLCDPRINT9
 
219
        movlw   244
 
220
        movwf   SysWaitTempMS,ACCESS
 
221
        movlw   1
 
222
        movwf   SysWaitTempMS_H,ACCESS
 
223
        rcall   Delay_MS
 
224
        decfsz  SysRepeatTemp1,F,BANKED
 
225
        bra     SysRepeatLoop1
 
226
SysRepeatLoopEnd1
 
227
        movlw   1
 
228
        movwf   SysWaitTempS,ACCESS
 
229
        rcall   Delay_S
 
230
        clrf    CC_X,BANKED
 
231
        clrf    C_X,BANKED
 
232
        clrf    C_Y,BANKED
 
233
        clrf    D_X,BANKED
 
234
        clrf    D_Y,BANKED
 
235
SysDoLoop_S1
 
236
        bsf     LATB,0,ACCESS
 
237
        rcall   ANIMATE
 
238
        movlw   200
 
239
        movwf   SysWaitTempMS,ACCESS
 
240
        clrf    SysWaitTempMS_H,ACCESS
 
241
        rcall   Delay_MS
 
242
        bcf     LATB,0,ACCESS
 
243
        rcall   ANIMATE
 
244
        movlw   200
 
245
        movwf   SysWaitTempMS,ACCESS
 
246
        clrf    SysWaitTempMS_H,ACCESS
 
247
        rcall   Delay_MS
 
248
        bra     SysDoLoop_S1
 
249
SysDoLoop_E1
 
250
BASPROGRAMEND
 
251
        sleep
 
252
        bra     BASPROGRAMEND
 
253
 
 
254
;********************************************************************************
 
255
 
 
256
ANIMATE
 
257
        movf    C_X,W,BANKED
 
258
        sublw   78
 
259
        btfsc   STATUS, C,ACCESS
 
260
        bra     ELSE1_1
 
261
        decf    DISPLAY,W,BANKED
 
262
        btfss   STATUS, Z,ACCESS
 
263
        bra     ENDIF9
 
264
        bsf     LATB,3,ACCESS
 
265
        bcf     LATB,2,ACCESS
 
266
        movlw   2
 
267
        movwf   DISPLAY,BANKED
 
268
        lfsr    1,SYSSTRINGPARAM1
 
269
        movlw   low StringTable6
 
270
        movwf   TBLPTRL,ACCESS
 
271
        movlw   high StringTable6
 
272
        movwf   TBLPTRH,ACCESS
 
273
        rcall   SysReadString
 
274
        movlw   low SYSSTRINGPARAM1
 
275
        movwf   SysPRINTDATAHandler,BANKED
 
276
        movlw   high SYSSTRINGPARAM1
 
277
        movwf   SysPRINTDATAHandler_H,BANKED
 
278
        rcall   HSERPRINT125
 
279
        movlw   10
 
280
        movwf   SERDATA,BANKED
 
281
        rcall   HSERSEND
 
282
ENDIF9
 
283
        bra     ENDIF1
 
284
ELSE1_1
 
285
        movlw   2
 
286
        subwf   DISPLAY,W,BANKED
 
287
        btfss   STATUS, Z,ACCESS
 
288
        bra     ENDIF10
 
289
        bcf     LATB,3,ACCESS
 
290
        bsf     LATB,2,ACCESS
 
291
        movlw   1
 
292
        movwf   DISPLAY,BANKED
 
293
        lfsr    1,SYSSTRINGPARAM1
 
294
        movlw   low StringTable5
 
295
        movwf   TBLPTRL,ACCESS
 
296
        movlw   high StringTable5
 
297
        movwf   TBLPTRH,ACCESS
 
298
        rcall   SysReadString
 
299
        movlw   low SYSSTRINGPARAM1
 
300
        movwf   SysPRINTDATAHandler,BANKED
 
301
        movlw   high SYSSTRINGPARAM1
 
302
        movwf   SysPRINTDATAHandler_H,BANKED
 
303
        rcall   HSERPRINT125
 
304
        movlw   10
 
305
        movwf   SERDATA,BANKED
 
306
        rcall   HSERSEND
 
307
ENDIF10
 
308
ENDIF1
 
309
        movff   CC_X,GLCDP_X
 
310
        movff   C_Y,GLCDP_Y
 
311
        rcall   GLCDGOTOXY
 
312
        lfsr    1,SYSSTRINGPARAM1
 
313
        movlw   low StringTable3
 
314
        movwf   TBLPTRL,ACCESS
 
315
        movlw   high StringTable3
 
316
        movwf   TBLPTRH,ACCESS
 
317
        rcall   SysReadString
 
318
        movlw   low SYSSTRINGPARAM1
 
319
        movwf   SysGLCDSTRDATHandler,BANKED
 
320
        movlw   high SYSSTRINGPARAM1
 
321
        movwf   SysGLCDSTRDATHandler_H,BANKED
 
322
        rcall   GLCDPRINT9
 
323
        movf    D_X,F,BANKED
 
324
        btfss   STATUS, Z,ACCESS
 
325
        bra     ELSE2_1
 
326
        movlw   6
 
327
        addwf   C_X,F,BANKED
 
328
        bra     ENDIF2
 
329
ELSE2_1
 
330
        movlw   6
 
331
        subwf   C_X,F,BANKED
 
332
ENDIF2
 
333
        movf    D_Y,F,BANKED
 
334
        btfss   STATUS, Z,ACCESS
 
335
        bra     ELSE3_1
 
336
        incf    C_Y,F,BANKED
 
337
        bra     ENDIF3
 
338
ELSE3_1
 
339
        decf    C_Y,F,BANKED
 
340
ENDIF3
 
341
        movlw   5
 
342
        subwf   C_Y,W,BANKED
 
343
        btfss   STATUS, Z,ACCESS
 
344
        bra     ENDIF4
 
345
        movlw   1
 
346
        movwf   D_Y,BANKED
 
347
ENDIF4
 
348
        movf    C_Y,F,BANKED
 
349
        btfsc   STATUS, Z,ACCESS
 
350
        clrf    D_Y,BANKED
 
351
        movlw   162
 
352
        subwf   C_X,W,BANKED
 
353
        btfss   STATUS, Z,ACCESS
 
354
        bra     ENDIF6
 
355
        movlw   1
 
356
        movwf   D_X,BANKED
 
357
ENDIF6
 
358
        movf    C_X,F,BANKED
 
359
        btfsc   STATUS, Z,ACCESS
 
360
        clrf    D_X,BANKED
 
361
        movf    C_X,W,BANKED
 
362
        sublw   78
 
363
        btfsc   STATUS, C,ACCESS
 
364
        bra     ELSE8_1
 
365
        movlw   84
 
366
        subwf   C_X,W,BANKED
 
367
        movwf   CC_X,BANKED
 
368
        decf    DISPLAY,W,BANKED
 
369
        btfss   STATUS, Z,ACCESS
 
370
        bra     ENDIF11
 
371
        bsf     LATB,3,ACCESS
 
372
        bcf     LATB,2,ACCESS
 
373
        movlw   2
 
374
        movwf   DISPLAY,BANKED
 
375
        lfsr    1,SYSSTRINGPARAM1
 
376
        movlw   low StringTable6
 
377
        movwf   TBLPTRL,ACCESS
 
378
        movlw   high StringTable6
 
379
        movwf   TBLPTRH,ACCESS
 
380
        rcall   SysReadString
 
381
        movlw   low SYSSTRINGPARAM1
 
382
        movwf   SysPRINTDATAHandler,BANKED
 
383
        movlw   high SYSSTRINGPARAM1
 
384
        movwf   SysPRINTDATAHandler_H,BANKED
 
385
        rcall   HSERPRINT125
 
386
        movlw   10
 
387
        movwf   SERDATA,BANKED
 
388
        rcall   HSERSEND
 
389
ENDIF11
 
390
        bra     ENDIF8
 
391
ELSE8_1
 
392
        movff   C_X,CC_X
 
393
        movlw   2
 
394
        subwf   DISPLAY,W,BANKED
 
395
        btfss   STATUS, Z,ACCESS
 
396
        bra     ENDIF12
 
397
        bcf     LATB,3,ACCESS
 
398
        bsf     LATB,2,ACCESS
 
399
        movlw   1
 
400
        movwf   DISPLAY,BANKED
 
401
        lfsr    1,SYSSTRINGPARAM1
 
402
        movlw   low StringTable5
 
403
        movwf   TBLPTRL,ACCESS
 
404
        movlw   high StringTable5
 
405
        movwf   TBLPTRH,ACCESS
 
406
        rcall   SysReadString
 
407
        movlw   low SYSSTRINGPARAM1
 
408
        movwf   SysPRINTDATAHandler,BANKED
 
409
        movlw   high SYSSTRINGPARAM1
 
410
        movwf   SysPRINTDATAHandler_H,BANKED
 
411
        rcall   HSERPRINT125
 
412
        movlw   10
 
413
        movwf   SERDATA,BANKED
 
414
        rcall   HSERSEND
 
415
ENDIF12
 
416
ENDIF8
 
417
        movff   CC_X,GLCDP_X
 
418
        movff   C_Y,GLCDP_Y
 
419
        rcall   GLCDGOTOXY
 
420
        lfsr    1,SYSSTRINGPARAM1
 
421
        movlw   low StringTable4
 
422
        movwf   TBLPTRL,ACCESS
 
423
        movlw   high StringTable4
 
424
        movwf   TBLPTRH,ACCESS
 
425
        rcall   SysReadString
 
426
        movlw   low SYSSTRINGPARAM1
 
427
        movwf   SysGLCDSTRDATHandler,BANKED
 
428
        movlw   high SYSSTRINGPARAM1
 
429
        movwf   SysGLCDSTRDATHandler_H,BANKED
 
430
        rcall   GLCDPRINT9
 
431
        lfsr    1,SYSSTRINGPARAM1
 
432
        movlw   low StringTable4
 
433
        movwf   TBLPTRL,ACCESS
 
434
        movlw   high StringTable4
 
435
        movwf   TBLPTRH,ACCESS
 
436
        rcall   SysReadString
 
437
        movlw   low SYSSTRINGPARAM1
 
438
        movwf   SysPRINTDATAHandler,BANKED
 
439
        movlw   high SYSSTRINGPARAM1
 
440
        movwf   SysPRINTDATAHandler_H,BANKED
 
441
        bra     HSERPRINT125
 
442
 
 
443
;********************************************************************************
 
444
 
 
445
ASCII_TABLE_H
 
446
        movlw   241
 
447
        cpfslt  SysStringA,ACCESS
 
448
        retlw   0
 
449
        movf    SysStringA, W,ACCESS
 
450
        addlw   low TableASCII_TABLE_H
 
451
        movwf   TBLPTRL,ACCESS
 
452
        movlw   high TableASCII_TABLE_H
 
453
        btfsc   STATUS, C,ACCESS
 
454
        addlw   1
 
455
        movwf   TBLPTRH,ACCESS
 
456
        tblrd*
 
457
        movf    TABLAT, W,ACCESS
 
458
        return
 
459
TableASCII_TABLE_H
 
460
        db      240,127,9,9,9,6,62,65,81,33,94,127,9,25,41,70,70,73,73,73,49,1,1,127,1,1,63,64
 
461
        db      64,64,63,31,32,64,32,31,63,64,56,64,63,99,20,8,20,99,7,8,112,8,7,97,81,73,69,67
 
462
        db      0,127,65,65,0,2,4,8,16,32,0,65,65,127,0,4,2,1,2,4,64,64,64,64,64,0,1,2,4,0,32,84
 
463
        db      84,84,120,127,72,68,68,56,56,68,68,68,32,56,68,68,72,127,56,84,84,84,24,8,126,9
 
464
        db      1,2,12,82,82,82,62,127,8,4,4,120,0,68,125,64,0,32,64,68,61,0,127,16,40,68,0,0
 
465
        db      65,127,64,0,124,4,24,4,120,124,8,4,4,120,56,68,68,68,56,124,20,20,20,8,8,20,20,24
 
466
        db      124,124,8,4,4,8,72,84,84,84,32,4,63,68,64,32,60,64,64,32,124,28,32,64,32,28,60,64
 
467
        db      48,64,60,68,40,16,40,68,12,80,80,80,60,68,100,84,76,68,0,8,54,65,0,0,0,127,0,0
 
468
        db      0,65,54,8,0,16,8,8,16,8,0,6,9,9,6
 
469
 
 
470
;********************************************************************************
 
471
 
 
472
ASCII_TABLE_L
 
473
        movlw   241
 
474
        cpfslt  SysStringA,ACCESS
 
475
        retlw   0
 
476
        movf    SysStringA, W,ACCESS
 
477
        addlw   low TableASCII_TABLE_L
 
478
        movwf   TBLPTRL,ACCESS
 
479
        movlw   high TableASCII_TABLE_L
 
480
        btfsc   STATUS, C,ACCESS
 
481
        addlw   1
 
482
        movwf   TBLPTRH,ACCESS
 
483
        tblrd*
 
484
        movf    TABLAT, W,ACCESS
 
485
        return
 
486
TableASCII_TABLE_L
 
487
        db      240,0,0,0,0,0,0,0,95,0,0,0,7,0,7,0,20,127,20,127,20,36,42,127,42,18,35,19,8,100
 
488
        db      98,54,73,85,34,80,0,5,3,0,0,0,28,34,65,0,0,65,34,28,0,20,8,62,8,20,8,8,62,8,8,0
 
489
        db      80,48,0,0,8,8,8,8,8,0,96,96,0,0,32,16,8,4,2,62,81,73,69,62,0,66,127,64,0,66,97,81
 
490
        db      73,70,33,65,69,75,49,24,20,18,127,16,39,69,69,69,57,60,74,73,73,48,1,113,9,5,3,54
 
491
        db      73,73,73,54,6,73,73,41,30,0,54,54,0,0,0,86,54,0,0,8,20,34,65,0,20,20,20,20,20,0
 
492
        db      65,34,20,8,2,1,81,9,6,50,73,121,65,62,126,17,17,17,126,127,73,73,73,54,62,65,65,65
 
493
        db      34,127,65,65,34,28,127,73,73,73,65,127,9,9,9,1,62,65,73,73,122,127,8,8,8,127,0,65
 
494
        db      127,65,0,32,64,65,63,1,127,8,20,34,65,127,64,64,64,64,127,2,12,2,127,127,4,8,16,127
 
495
        db      62,65,65,65,62
 
496
 
 
497
;********************************************************************************
 
498
 
 
499
Delay_MS
 
500
        incf    SysWaitTempMS_H, F,ACCESS
 
501
DMS_START
 
502
        movlw   108
 
503
        movwf   DELAYTEMP2,ACCESS
 
504
DMS_OUTER
 
505
        movlw   11
 
506
        movwf   DELAYTEMP,ACCESS
 
507
DMS_INNER
 
508
        decfsz  DELAYTEMP, F,ACCESS
 
509
        bra     DMS_INNER
 
510
        decfsz  DELAYTEMP2, F,ACCESS
 
511
        bra     DMS_OUTER
 
512
        decfsz  SysWaitTempMS, F,ACCESS
 
513
        bra     DMS_START
 
514
        decfsz  SysWaitTempMS_H, F,ACCESS
 
515
        bra     DMS_START
 
516
        return
 
517
 
 
518
;********************************************************************************
 
519
 
 
520
Delay_S
 
521
DS_START
 
522
        movlw   232
 
523
        movwf   SysWaitTempMS,ACCESS
 
524
        movlw   3
 
525
        movwf   SysWaitTempMS_H,ACCESS
 
526
        rcall   Delay_MS
 
527
        decfsz  SysWaitTempS, F,ACCESS
 
528
        bra     DS_START
 
529
        return
 
530
 
 
531
;********************************************************************************
 
532
 
 
533
GLCDCHARACTER
 
534
        movlw   80
 
535
        subwf   GLCDCHAR,W,BANKED
 
536
        btfsc   STATUS, C,ACCESS
 
537
        bra     ELSE24_1
 
538
        movlw   32
 
539
        subwf   GLCDCHAR,W,BANKED
 
540
        movwf   SysTemp1,BANKED
 
541
        mullw   5
 
542
        movff   PRODL,GLCDCHAR
 
543
        movlw   5
 
544
        movwf   SysRepeatTemp4,BANKED
 
545
SysRepeatLoop4
 
546
        incf    GLCDCHAR,F,BANKED
 
547
        movff   GLCDCHAR,SysStringA
 
548
        rcall   ASCII_TABLE_L
 
549
        movwf   CHARLINE,BANKED
 
550
        movlw   1
 
551
        movwf   GLCDCOMDAT,BANKED
 
552
        movff   CHARLINE,GLCDDAT
 
553
        rcall   GLCDWRITE
 
554
        movff   GLCDDAT,CHARLINE
 
555
        decfsz  SysRepeatTemp4,F,BANKED
 
556
        bra     SysRepeatLoop4
 
557
SysRepeatLoopEnd4
 
558
        bra     ENDIF24
 
559
ELSE24_1
 
560
        movlw   80
 
561
        subwf   GLCDCHAR,W,BANKED
 
562
        movwf   SysTemp1,BANKED
 
563
        mullw   5
 
564
        movff   PRODL,GLCDCHAR
 
565
        movlw   5
 
566
        movwf   SysRepeatTemp4,BANKED
 
567
SysRepeatLoop5
 
568
        incf    GLCDCHAR,F,BANKED
 
569
        movff   GLCDCHAR,SysStringA
 
570
        rcall   ASCII_TABLE_H
 
571
        movwf   CHARLINE,BANKED
 
572
        movlw   1
 
573
        movwf   GLCDCOMDAT,BANKED
 
574
        movff   CHARLINE,GLCDDAT
 
575
        rcall   GLCDWRITE
 
576
        movff   GLCDDAT,CHARLINE
 
577
        decfsz  SysRepeatTemp4,F,BANKED
 
578
        bra     SysRepeatLoop5
 
579
SysRepeatLoopEnd5
 
580
ENDIF24
 
581
        movlw   1
 
582
        movwf   GLCDCOMDAT,BANKED
 
583
        clrf    GLCDDAT,BANKED
 
584
        bra     GLCDWRITE
 
585
 
 
586
;********************************************************************************
 
587
 
 
588
GLCDCLEAR
 
589
        movlw   247
 
590
        movwf   SysRepeatTemp3,BANKED
 
591
        movlw   2
 
592
        movwf   SysRepeatTemp3_H,BANKED
 
593
SysRepeatLoop3
 
594
        movlw   1
 
595
        movwf   GLCDCOMDAT,BANKED
 
596
        clrf    GLCDDAT,BANKED
 
597
        rcall   GLCDWRITE
 
598
        decfsz  SysRepeatTemp3,F,BANKED
 
599
        bra     SysRepeatLoop3
 
600
        decfsz  SysRepeatTemp3_H,F,BANKED
 
601
        bra     SysRepeatLoop3
 
602
SysRepeatLoopEnd3
 
603
        return
 
604
 
 
605
;********************************************************************************
 
606
 
 
607
GLCDDRAWFRAME
 
608
        setf    GLCDINDEX,BANKED
 
609
SysForLoop2
 
610
        incf    GLCDINDEX,F,BANKED
 
611
        movff   GLCDINDEX,GLCDP_X
 
612
        clrf    GLCDP_Y,BANKED
 
613
        rcall   GLCDGOTOXY
 
614
        movlw   1
 
615
        movwf   GLCDCOMDAT,BANKED
 
616
        movlw   1
 
617
        movwf   GLCDDAT,BANKED
 
618
        rcall   GLCDWRITE
 
619
        movlw   83
 
620
        subwf   GLCDINDEX,W,BANKED
 
621
        btfss   STATUS, C,ACCESS
 
622
        bra     SysForLoop2
 
623
SysForLoopEnd2
 
624
        setf    GLCDINDEX,BANKED
 
625
SysForLoop3
 
626
        incf    GLCDINDEX,F,BANKED
 
627
        movff   GLCDINDEX,GLCDP_X
 
628
        movlw   5
 
629
        movwf   GLCDP_Y,BANKED
 
630
        rcall   GLCDGOTOXY
 
631
        movlw   1
 
632
        movwf   GLCDCOMDAT,BANKED
 
633
        movlw   128
 
634
        movwf   GLCDDAT,BANKED
 
635
        rcall   GLCDWRITE
 
636
        movlw   83
 
637
        subwf   GLCDINDEX,W,BANKED
 
638
        btfss   STATUS, C,ACCESS
 
639
        bra     SysForLoop3
 
640
SysForLoopEnd3
 
641
        setf    GLCDINDEX,BANKED
 
642
SysForLoop4
 
643
        incf    GLCDINDEX,F,BANKED
 
644
        movlw   83
 
645
        movwf   GLCDP_X,BANKED
 
646
        movff   GLCDINDEX,GLCDP_Y
 
647
        rcall   GLCDGOTOXY
 
648
        movlw   1
 
649
        movwf   GLCDCOMDAT,BANKED
 
650
        setf    GLCDDAT,BANKED
 
651
        rcall   GLCDWRITE
 
652
        movlw   5
 
653
        subwf   GLCDINDEX,W,BANKED
 
654
        btfss   STATUS, C,ACCESS
 
655
        bra     SysForLoop4
 
656
SysForLoopEnd4
 
657
        setf    GLCDINDEX,BANKED
 
658
SysForLoop5
 
659
        incf    GLCDINDEX,F,BANKED
 
660
        clrf    GLCDP_X,BANKED
 
661
        movff   GLCDINDEX,GLCDP_Y
 
662
        rcall   GLCDGOTOXY
 
663
        movlw   1
 
664
        movwf   GLCDCOMDAT,BANKED
 
665
        setf    GLCDDAT,BANKED
 
666
        rcall   GLCDWRITE
 
667
        movlw   5
 
668
        subwf   GLCDINDEX,W,BANKED
 
669
        btfss   STATUS, C,ACCESS
 
670
        bra     SysForLoop5
 
671
SysForLoopEnd5
 
672
        return
 
673
 
 
674
;********************************************************************************
 
675
 
 
676
GLCDGOTOXY
 
677
        clrf    GLCDCOMDAT,BANKED
 
678
        movlw   128
 
679
        iorwf   GLCDP_X,W,BANKED
 
680
        movwf   GLCDDAT,BANKED
 
681
        rcall   GLCDWRITE
 
682
        clrf    GLCDCOMDAT,BANKED
 
683
        movlw   64
 
684
        iorwf   GLCDP_Y,W,BANKED
 
685
        movwf   GLCDDAT,BANKED
 
686
        bra     GLCDWRITE
 
687
 
 
688
;********************************************************************************
 
689
 
 
690
;Overloaded signature: STRING:
 
691
GLCDPRINT9
 
692
        clrf    GLCDINDEX,BANKED
 
693
        movff   SysGLCDSTRDATHandler,AFSR0
 
694
        movff   SysGLCDSTRDATHandler_H,AFSR0_H
 
695
        movlw   1
 
696
        subwf   INDF0,W,ACCESS
 
697
        btfss   STATUS, C,ACCESS
 
698
        bra     SysForLoopEnd1
 
699
SysForLoop1
 
700
        incf    GLCDINDEX,F,BANKED
 
701
        movf    GLCDINDEX,W,BANKED
 
702
        addwf   SysGLCDSTRDATHandler,W,BANKED
 
703
        movwf   AFSR0,ACCESS
 
704
        movlw   0
 
705
        addwfc  SysGLCDSTRDATHandler_H,W,BANKED
 
706
        movwf   AFSR0_H,ACCESS
 
707
        movff   INDF0,GLCDCHAR
 
708
        rcall   GLCDCHARACTER
 
709
        movf    GLCDINDEX,W,BANKED
 
710
        addwf   SysGLCDSTRDATHandler,W,BANKED
 
711
        movwf   AFSR0,ACCESS
 
712
        movlw   0
 
713
        addwfc  SysGLCDSTRDATHandler_H,W,BANKED
 
714
        movwf   AFSR0_H,ACCESS
 
715
        movff   GLCDCHAR,INDF0
 
716
        movff   SysGLCDSTRDATHandler,AFSR0
 
717
        movff   SysGLCDSTRDATHandler_H,AFSR0_H
 
718
        movf    INDF0,W,ACCESS
 
719
        subwf   GLCDINDEX,W,BANKED
 
720
        btfss   STATUS, C,ACCESS
 
721
        bra     SysForLoop1
 
722
SysForLoopEnd1
 
723
        return
 
724
 
 
725
;********************************************************************************
 
726
 
 
727
GLCDWRITE
 
728
        decf    GLCDCOMDAT,W,BANKED
 
729
        btfss   STATUS, Z,ACCESS
 
730
        bra     ELSE13_1
 
731
        bsf     LATB,6,ACCESS
 
732
        bra     ENDIF13
 
733
ELSE13_1
 
734
        bcf     LATB,6,ACCESS
 
735
ENDIF13
 
736
        movlw   8
 
737
        movwf   SysRepeatTemp2,BANKED
 
738
SysRepeatLoop2
 
739
        bcf     LATB,4,ACCESS
 
740
        btfss   GLCDDAT,7,BANKED
 
741
        bra     ELSE14_1
 
742
        bsf     LATB,5,ACCESS
 
743
        bra     ENDIF14
 
744
ELSE14_1
 
745
        bcf     LATB,5,ACCESS
 
746
ENDIF14
 
747
        rlcf    GLCDDAT,F,BANKED
 
748
        bsf     LATB,4,ACCESS
 
749
        nop
 
750
        nop
 
751
        nop
 
752
        nop
 
753
        decfsz  SysRepeatTemp2,F,BANKED
 
754
        bra     SysRepeatLoop2
 
755
SysRepeatLoopEnd2
 
756
        return
 
757
 
 
758
;********************************************************************************
 
759
 
 
760
;Overloaded signature: STRING:
 
761
HSERPRINT125
 
762
        movff   SysPRINTDATAHandler,AFSR0
 
763
        movff   SysPRINTDATAHandler_H,AFSR0_H
 
764
        movff   INDF0,PRINTLEN
 
765
        movf    PRINTLEN,F,BANKED
 
766
        btfsc   STATUS, Z,ACCESS
 
767
        bra     ENDIF21
 
768
        clrf    SYSPRINTTEMP,BANKED
 
769
        movlw   1
 
770
        subwf   PRINTLEN,W,BANKED
 
771
        btfss   STATUS, C,ACCESS
 
772
        bra     SysForLoopEnd6
 
773
SysForLoop6
 
774
        incf    SYSPRINTTEMP,F,BANKED
 
775
        movf    SYSPRINTTEMP,W,BANKED
 
776
        addwf   SysPRINTDATAHandler,W,BANKED
 
777
        movwf   AFSR0,ACCESS
 
778
        movlw   0
 
779
        addwfc  SysPRINTDATAHandler_H,W,BANKED
 
780
        movwf   AFSR0_H,ACCESS
 
781
        movff   INDF0,SERDATA
 
782
        rcall   HSERSEND
 
783
        movlw   12
 
784
        movwf   SysWaitTempMS,ACCESS
 
785
        clrf    SysWaitTempMS_H,ACCESS
 
786
        rcall   Delay_MS
 
787
        movf    PRINTLEN,W,BANKED
 
788
        subwf   SYSPRINTTEMP,W,BANKED
 
789
        btfss   STATUS, C,ACCESS
 
790
        bra     SysForLoop6
 
791
SysForLoopEnd6
 
792
ENDIF21
 
793
        return
 
794
 
 
795
;********************************************************************************
 
796
 
 
797
HSERSEND
 
798
SysWaitLoop1
 
799
        btfss   PIR1,TXIF,ACCESS
 
800
        bra     SysWaitLoop1
 
801
        movff   SERDATA,TXREG
 
802
        return
 
803
 
 
804
;********************************************************************************
 
805
 
 
806
INITGLCD
 
807
        bcf     LATB,7,ACCESS
 
808
        movlw   100
 
809
        movwf   SysWaitTempMS,ACCESS
 
810
        clrf    SysWaitTempMS_H,ACCESS
 
811
        rcall   Delay_MS
 
812
        bsf     LATB,7,ACCESS
 
813
        clrf    GLCDCOMDAT,BANKED
 
814
        movlw   33
 
815
        movwf   GLCDDAT,BANKED
 
816
        rcall   GLCDWRITE
 
817
        clrf    GLCDCOMDAT,BANKED
 
818
        movlw   191
 
819
        movwf   GLCDDAT,BANKED
 
820
        rcall   GLCDWRITE
 
821
        clrf    GLCDCOMDAT,BANKED
 
822
        movlw   4
 
823
        movwf   GLCDDAT,BANKED
 
824
        rcall   GLCDWRITE
 
825
        clrf    GLCDCOMDAT,BANKED
 
826
        movlw   20
 
827
        movwf   GLCDDAT,BANKED
 
828
        rcall   GLCDWRITE
 
829
        clrf    GLCDCOMDAT,BANKED
 
830
        movlw   12
 
831
        movwf   GLCDDAT,BANKED
 
832
        rcall   GLCDWRITE
 
833
        clrf    GLCDCOMDAT,BANKED
 
834
        movlw   32
 
835
        movwf   GLCDDAT,BANKED
 
836
        rcall   GLCDWRITE
 
837
        clrf    GLCDCOMDAT,BANKED
 
838
        movlw   12
 
839
        movwf   GLCDDAT,BANKED
 
840
        bra     GLCDWRITE
 
841
 
 
842
;********************************************************************************
 
843
 
 
844
INITSYS
 
845
        clrf    BSR,ACCESS
 
846
        clrf    TBLPTRU,ACCESS
 
847
        bcf     ADCON2,ADFM,ACCESS
 
848
        bcf     ADCON0,ADON,ACCESS
 
849
        bsf     ADCON1,PCFG3,ACCESS
 
850
        bsf     ADCON1,PCFG2,ACCESS
 
851
        bsf     ADCON1,PCFG1,ACCESS
 
852
        bsf     ADCON1,PCFG0,ACCESS
 
853
        movlw   7
 
854
        movwf   CMCON,ACCESS
 
855
        clrf    PORTA,ACCESS
 
856
        clrf    PORTB,ACCESS
 
857
        clrf    PORTC,ACCESS
 
858
        clrf    PORTE,ACCESS
 
859
        return
 
860
 
 
861
;********************************************************************************
 
862
 
 
863
INITUSART
 
864
        movlw   33
 
865
        movwf   SPBRG,ACCESS
 
866
        clrf    SPBRGH,ACCESS
 
867
        bsf     BAUDCON,BRG16,ACCESS
 
868
        bsf     TXSTA,BRGH,ACCESS
 
869
        bcf     TXSTA,SYNC,ACCESS
 
870
        bsf     RCSTA,SPEN,ACCESS
 
871
        bsf     RCSTA,CREN,ACCESS
 
872
        bsf     TXSTA,TXEN,ACCESS
 
873
        return
 
874
 
 
875
;********************************************************************************
 
876
 
 
877
SYSREADSTRING
 
878
        tblrd*+
 
879
        movff   TABLAT,SYSCALCTEMPA
 
880
        movff   TABLAT,INDF1
 
881
        tblrd*+
 
882
        bra     SYSSTRINGREADCHECK
 
883
SYSREADSTRINGPART
 
884
        tblrd*+
 
885
        movf    TABLAT, W,ACCESS
 
886
        movwf   SYSCALCTEMPA,ACCESS
 
887
        addwf   SYSSTRINGLENGTH,F,ACCESS
 
888
        tblrd*+
 
889
SYSSTRINGREADCHECK
 
890
        movf    SYSCALCTEMPA,F,ACCESS
 
891
        btfsc   STATUS,Z,ACCESS
 
892
        return
 
893
SYSSTRINGREAD
 
894
        tblrd*+
 
895
        movff   TABLAT,PREINC1
 
896
        decfsz  SYSCALCTEMPA, F,ACCESS
 
897
        bra     SYSSTRINGREAD
 
898
        return
 
899
 
 
900
;********************************************************************************
 
901
 
 
902
SysStringTables
 
903
 
 
904
StringTable1
 
905
        dw      2827,"  Display-1"
 
906
 
 
907
 
 
908
StringTable2
 
909
        dw      2827,"  Display-2"
 
910
 
 
911
 
 
912
StringTable3
 
913
        dw      257," "
 
914
 
 
915
 
 
916
StringTable4
 
917
        dw      257,"*"
 
918
 
 
919
 
 
920
StringTable5
 
921
        dw      4883,"Printing Display: 1"
 
922
 
 
923
 
 
924
StringTable6
 
925
        dw      4883,"Printing Display: 2"
 
926
 
 
927
 
 
928
;********************************************************************************
 
929
 
 
930
 
 
931
 END