source: branches/AS8051toC/Test/Test.a51

Last change on this file was 25, checked in by chronos, 12 years ago
  • Upraveno: Rozšířeno převádění kódu na další případy.
File size: 124.8 KB
Line 
1 ; AKTIVUJ WDG
2 MOV WDTRST,#01Eh
3 MOV WDTRST,#0E1h
4
5
6 MOV CLKREG,#01
7 MOV IE,#000h
8
9 ; VYMAZU RAM
10 MOV R0,#0FFh
11 sss:
12 %L(CL):
13 MOV @R0,#0
14 DJNZ R0,%L(CL)
15
16 ; INICIALIZACE ZASOBNIKU
17 MOV SP,#STACKINIT ; INIC. ZASOBNIKU
18
19 ; PREDNASTAVIM SI PREDDELIC PRO 10ms
20 MOV DIV10MS,#nbr10ms
21 MOV DIV100MS,#10 ;10 x 10 = 100ms
22
23 MOV BLINKTLACTMR,#2 ; NASTAVENI CASOVACE BLIKACKY
24
25 ; OTESTUJ, ZDA JE PARAMETR 12 (ZOBRAZENI VYPADKU KOMUNIKACE) NENULOVY
26 MOV DPTR,#P11 ; NEJPRVE NACTI, JESTLI MAS POVOLENE ZOBRAZENI TEXTU
27 CALL GET_BIT_PARM
28 MOV TDEFECT,C ; ULOZ
29
30 MOV DPTR,#P12
31 CALL TEST_PARM
32
33 ANL C,TDEFECT ; Cy = 1 TEHDY, POKUD EXISTUJE NEJAKY TEXT A JE POVOLENO JEHO ZOBRAZENI
34 ORL C,F0
35 MOV TDEFECT,C ; PRIZNAK = 1, POKUD JE NEJAKY TEXT NEBO JE BITMAPA
36
37 ; OTESTUJ, ZDA JE PARAMETR 14 (ZOBRAZENI POZARNI JIZDY) NENULOVY
38 MOV DPTR,#P13 ; NEJPRVE NACTI, JESTLI MAS POVOLENE ZOBRAZENI TEXTU
39 CALL GET_BIT_PARM
40 MOV TFIRE,C ; ULOZ
41
42 MOV DPTR,#P14
43 CALL TEST_PARM
44
45 ANL C,TFIRE ; Cy = 1 TEHDY, POKUD EXISTUJE NEJAKY TEXT A JE POVOLENO JEHO ZOBRAZENI
46 ORL C,F0
47 MOV TFIRE,C ; PRIZNAK = 1, POKUD JE NEJAKY TEXT NEBO JE BITMAPA
48
49 ; OTESTUJ, ZDA JE PARAMETR 10 (ZOBRAZENI PRETIZENO) NENULOVY
50 MOV DPTR,#P09 ; NEJPRVE NACTI, JESTLI MAS POVOLENE ZOBRAZENI TEXTU
51 CALL GET_BIT_PARM
52 MOV TOVERLOAD,C ; ULOZ
53
54 MOV DPTR,#P10
55 CALL TEST_PARM
56
57 ANL C,TOVERLOAD ; Cy = 1 TEHDY, POKUD EXISTUJE NEJAKY TEXT A JE POVOLENO JEHO ZOBRAZENI
58 ORL C,F0
59 MOV TOVERLOAD,C ; PRIZNAK = 1, POKUD JE NEJAKY TEXT NEBO JE BITMAPA
60
61 ; OTESTUJ, ZDA JE PARAMETR 19 (ZOBRAZENI REVIZE) NENULOVY
62 MOV DPTR,#P18 ; NEJPRVE NACTI, JESTLI MAS POVOLENE ZOBRAZENI TEXTU
63 CALL GET_BIT_PARM
64 MOV TREVIZE,C ; ULOZ
65
66 MOV DPTR,#P19
67 CALL TEST_PARM
68
69 ANL C,TREVIZE ; Cy = 1 TEHDY, POKUD EXISTUJE NEJAKY TEXT A JE POVOLENO JEHO ZOBRAZENI
70 ORL C,F0
71 MOV TREVIZE,C ; PRIZNAK = 1, POKUD JE NEJAKY TEXT NEBO JE BITMAPA
72
73 ; OTESTUJ, ZDA JE PARAMETR 24 (ZOBRAZENI REKLAMY) NENULOVY
74 MOV DPTR,#P23 ; NEJPRVE NACTI, JESTLI MAS POVOLENE ZOBRAZENI TEXTU
75 CALL GET_BIT_PARM
76 MOV TREKLAMA,C ; ULOZ
77
78 MOV DPTR,#P24
79 CALL TEST_PARM
80
81 ANL C,TREKLAMA ; Cy = 1 TEHDY, POKUD EXISTUJE NEJAKY TEXT A JE POVOLENO JEHO ZOBRAZENI
82 ORL C,F0
83 MOV TREKLAMA,C ; PRIZNAK = 1, POKUD JE NEJAKY TEXT NEBO JE BITMAPA
84
85 ; NACTI ROTACI DISPLEJE
86 MOV DPTR,#P15 ; ULOZ DO DPTR DANY PARAMETR
87 CALL GET_BIT_PARM
88 MOV ROTATEDISP,C
89
90 MOV DPTR,#P21
91 CALL GET_BIT_PARM
92 MOV PROTOKOL,C ; NACTI TYP KOMUNIKACNIHO PROTOKOLU
93
94 ORL POS,#maskPosRefr ; NASTAV PRIZNAK ZMENY, AT SE NECO ZOBRAZI PO RESTARTU
95;-------------------------------------------------------------------------------
96; NASTAVIM SI JEDNOTLIVE FLAGY A JEDEME ...
97;-------------------------------------------------------------------------------
98 MOV PCON,#10000000b
99; | ||||-- IDL idle mode
100; | |||--- PD power-down mode
101; | ||---- GF0 general purpose flag
102; | |----- GF1 general purpose flag
103; |--------- SMOD baud rate doubling
104
105 MOV TH1,#TTIMER1INT ; RYCHLOST NASTAVENA NA 9600 BAUDU
106
107; NASTAVENI CITACE/CASOVACE 2
108 MOV RCAP2L,#LOW(TTIMER2INT)
109 MOV RCAP2H,#HIGH(TTIMER2INT)
110 MOV TH2,#HIGH(TTIMER2INT)
111 MOV TL2,#LOW(TTIMER2INT)
112
113 ; TMOD2 JE PO RESETU = 0
114 MOV T2MOD,#0
115
116 ; NASTARTUJ CASOVAC
117 MOV T2CON,#00000100b ; TR2 = 1
118
119 MOV TMOD,#00100001b
120; ||||||||-- timer 0 mode 00 - 8 bit,prescaler
121; |||||| 01 - 16 bit
122; |||||| 10 - 8 bit,auto-reload
123; |||||| 11 - 2 x 8 bit
124; ||||||---- timer 0 C/T# (counter / timer)
125; ||||| 0 - timer
126; ||||| 1 - counter
127; |||||----- timer 0 GATE gating control
128; |||| 1 - gating on
129; |||| 0 - gating off
130; ||||------ timer 1 mode 00 - 8 bit,prescaler
131; || 01 - 16 bit
132; || 10 - 8 bit,auto-reload
133; || 11 - 2 x 8 bit
134; ||-------- timer 1 C/T# (counter / timer)
135; | 0 - timer
136; | 1 - counter
137; |--------- timer 1 GATE gating control
138; 1 - gating on
139; 0 - gating off
140
141
142 MOV SCON,#01010000b
143; ||||||||-- RI receiver interrupt
144; |||||||--- TI trasmitter interrupt
145; ||||||---- RB8 receiver bit 8
146; |||||----- TB8 trasmitter bit 8
147; ||||------ REN receiver enable
148; |||------- SM2 multiprocessor feature
149; ||-------- SM0,1 serial mode
150; 00 - shift register, fixed
151; 01 - 8-bit UART, variable
152; 10 - 9-bit UART, fixed
153; 11 - 9-bit UART, variable
154
155 MOV TCON,#01100000b
156; ||||||||--; IT0 INT0 trigger 0 - low level
157; ||||||| 1 - falling edge
158; |||||||--- IE0 INT0 edge flag
159; ||||||---- IT1 INT1 trigger
160; |||||----- IE1 INT1 edge flag
161; ||||------ TR0 timer 0 run control bit
162; |||------- TF0 timer 0 overflow flag
163; ||-------- TR1 timer 1 run control bit
164; |--------- TF1 timer 1 overflow flag
165;
166
167 MOV TL0,#LOW(TTIMER0INT) ; DOROVNEJ NA SPRAVNOU HODNOTU
168 MOV TH0,#HIGH(TTIMER0INT+7)
169
170 MOV IE, #10110010B ; INICIALIZACE PRERUSENI
171; | ||||||-- EX0 external INT0
172; | |||||--- ET0 timer 0 interrupt
173; | ||||---- EX1 external INT1
174; | |||----- ET1 timer 1 interrupt
175; | ||------ ES serial interrupt
176; | |------- ET2 timer 2 interrupt
177; |--------- EA all interrupts
178
179 MOV IP, #00110000b
180; ||||||-- PX0 external INT0 level
181; |||||--- PT0 timer 0 interrupt level
182; ||||---- PX1 external INT1 level
183; |||----- PT1 timer 1 interrupt level
184; ||------ PS serial interrupt level
185; |------- PT2 timer 2 interrupt level
186; NASTAV WATCHDOG - 0.5s
187 MOV WDTCON,#11100101b
188; ||||||||-- WDTEN
189; |||||||--- WSWRST
190; ||||||---- HWDT
191; |||||----- DISRTO
192; ||||------ WDIDLE
193; |||------- PS2, PS1, PS0 set wdg timer
194
195 CALL SERIAL_INIT ; INICIALIZUJ SERIOVOU LINKU
196 CALL LCD_INIT ; INICIALIZUJ LCD
197 ;CALL FLASH_INIT ; INICIALIZUJ FLASH
198 CALL MSP3_INIT ; INICIALIZUJ MSP3
199 MOV OUTSOLD,#0FFh
200 MOV MINTMR,#0FFH ; VLOZ PRODLEVU MIN. CASOVACE
201;*******************************************************************************
202;******************** HLAVNI SMYCKA PROGRAMU **********************
203;*******************************************************************************
204MainLoop:
205%IF(%DEBUG EQ 0)THEN
206(
207 ; === KOSTICKA PRO PEJSKA
208 CALL WdgReset ; OBSLUZ WDG
209)FI
210 ; === KVULI MERENI TRVANI PRUCHODU SMYCKOU
211%IF(0)THEN
212(
213 ; === HLIDEJ DOBU NECINNOSTI VE STAVECH >= VERSION
214 MOV A,STAV
215 %CMP(A,#SHOW_VERSION)
216 JC %L(_CONT0) ; JE-LI STAV < VERSION, NIC NETESTUJ
217 MOV A,MINTMR ; NACTI CASOVAC
218 MOV B,STAV
219 MOV STAV,#INIT_POSITION ; POKUD TI DOJEDE CASOVAC,TAK SKOC DO STAVU ZOBRAZENI POLOHY
220 JZ %L(_CONT0) ; JSI DLOUHO VE STAVU NECINNOSTI -> ZACNI ZOBRAZOVAT POLOHU
221 MOV STAV,B ; JESTE CASUJEC, POKRACUJ V AKTUALNIM STAVU
222
223 MOV R0,#KEYS+valKeyUP
224 MOV A,@R0
225 JB ACC.bitKeyPress,%L(SETTMR)
226 MOV R0,#KEYS+valKeyDN
227 MOV A,@R0
228 JB ACC.bitKeyPress,%L(SETTMR)
229 MOV R0,#KEYS+valKeyMode
230 MOV A,@R0
231 JB ACC.bitKeyPress,%L(SETTMR)
232
233 MOV MAXTMR,#0 ; NULUJ CASOVAC DELKY STISKU TLACITEK
234 SJMP %L(_CONT0)
235 %L(SETTMR):
236 MOV A,MAXTMR
237 %CJE(A,#255,%L(_CONT0)) ; POKUD TI UZ PRETEKL CITAC DELKY STISKU TLACITKA,TAK UZ CASOVAC CINNOSTI NEOBNOVUJ,
238 ; MUZES MIT ZAMACKLE TLACITKO
239 INC MAXTMR
240 ; OBNOV CASOVAC
241 MOV MINTMR,#0FFH ; VLOZ PRODLEVU MIN. CASOVACE
242 %L(_CONT0):
243)FI
244
245 ; === OVLADEJ SYSTEMOVOU LED - RID DLE STAVU SYSTEMU
246 MOV A,STAV
247 %CMP(A,#SHOW_VERSION)
248 JNC %L(MENU_LED)
249 ; === NORMALNI STAV - ROZLIS VYPADEK KOMUNIKACE A VSE V PORADKU
250 MOV A,SERTIM
251 JZ %L(ERR_COM)
252 MOV A,SYSTIMH
253 ANL A,#0FH
254 %CMP(A,#1)
255 CPL C
256 SJMP %L(WRITE_LED)
257 %L(ERR_COM):
258 MOV A,SYSTIMH
259 MOV C,ACC.0
260 SJMP %L(WRITE_LED)
261 ; === JSI V MENU - INDIKUJ DLE TOHO NA SYSLED
262 %L(MENU_LED):
263 MOV A,SYSTIMH
264 MOV C,ACC.2
265 %L(WRITE_LED):
266 MOV A,#O_SYSLED
267 MOV F0,C
268 CALL SET_OUTP
269 ; === OVLADEJ VYSTUPY
270 CALL OUT_MANAGE
271
272 ; ****************************************************************************
273 ; **
274 ; ** DETEKUJ DATA Z UARTU
275 ; **
276 ; ****************************************************************************
277 CALL DETECT_HDR
278 JNC %L(NXT0)
279
280 ;PRINTINT(#0,#20,#3,A,0) ; VYPIS AKTUALNI VYSTUP
281 ;MOV STAV,#WRITE_E2ROM
282 ;JMP %L(STATE_START)
283
284%IF(1)THEN
285(
286 ; REAGUJ NA SPECIFICKE ZPRAVY
287 %CJE(A,#6,%L(SEND_ANS_PING))
288 %CJE(A,#7,%L(SEND_ANS_VERSION))
289 %CJE(A,#10,%L(SEND_ANS_RESTART))
290)FI
291
292 %CMP(A,#STATE_TAB_LEN)
293 JNC %L(NXT0_) ; POKUD JE HODNOTA MIMO, ZADNY STAV NEPREPINEJ A UVOLNI PRIJEM
294
295 MOV DISPLIGHT,#4 ; POKUD PRISLA NEJAKA ZPRAVA, NASTAV JAS NA MAXIMUM
296 MOV DPTR,#%L(STATE_TABLE)
297 MOVC A,@A+DPTR
298 MOV STAV,A ; ZMEN STAV PODLE ZPRAVY
299 JMP %L(STATE_START) ; SKOC ROVNOU NA ZACATEK STAVOVEHO AUTOMATU
300
301%IF(1)THEN
302(
303 ; === ODESLI PRIMOU ODPOVED NA DOTAZ
304 %L(SEND_ANS_RESTART): ; ZASTAV PROGRAM, WATCHDOG BY MEL RESETOVAT JEDNOTKU
305 MOV DPTR,#RESTART_MSG
306 CALL ZERO_MSG
307 JNZ %L(NXT0_) ; V TELE ZPRAVY MUSI BYT 2x0,JINAK NIC NEDELEJ
308 CALL SEND_DATA
309 %L(HALT):
310 SJMP %L(HALT)
311
312 %L(SEND_ANS_PING):
313 MOV DPTR,#PING_MSG
314 CALL ZERO_MSG
315 JNZ %L(NXT0_) ; V TELE ZPRAVY MUSI BYT 2x0,JINAK NIC NEDELEJ
316 SJMP %L(SEND)
317
318 %L(SEND_ANS_VERSION):
319 MOV DPTR,#VERSION_ERR
320 CALL ZERO_MSG
321 JNZ %L(SEND) ; V TELE ZPRAVY MUSI BYT 2x0,JINAK NIC NEDELEJ
322 MOV DPTR,#VERSION_MSG
323 CALL SEND_DATA
324 ; === ODESLI POZADOVANE DATA
325 JB WRITE,$ ; DOKUD ZAPISUJES PREDCHOZI DATA,NIC NEDELEJ
326 MOV CRC8,#0
327 MOV A,#_MODEL
328 CALL SEND_BYTE2
329 MOV A,#_VERSION
330 CALL SEND_BYTE2
331 MOV A,#_REVISION
332 CALL SEND_BYTE2
333 MOV A,CRC8
334 CALL SEND_BYTE2
335 SJMP %L(NXT0_)
336 %L(SEND):
337 CALL SEND_DATA
338 SJMP %L(NXT0_)
339)FI
340 ; === STAVOVA TABULKA
341 %L(STATE_TABLE):
342 DB 00h ; NONE
343 DB PROGRAM_FLASH
344 DB ERASE_FLASH
345 DB ERASE_SECTOR
346 DB SEND_FLASH
347 DB 00H
348 DB 00H ; PING
349 DB 00H ; SW_VERSION
350 DB WRITE_E2ROM
351 DB READ_E2ROM
352 DB 00H ; RESTART
353 STATE_TAB_LEN EQU $ - %L(STATE_TABLE)
354
355 %L(NXT0_):
356 CLR HDR_RCVD
357
358 %L(NXT0):
359 MOV A,STAV
360
361 ; === KVULI KONFIG. STAVUM NASTAV SVIT NA MAXIMUM - JINAK TO NEHEZKY BLIKALO
362 %CMP(A,#ERASE_FLASH)
363 %JNC(%L(STATE_START))
364
365 %IF(0)THEN
366 (
367 ; OSETRI STAV, KDY PRIJIMAS PARAMETRY PO UARTU
368 JNB PARM_RCVD,%L(NXT00)
369 ; NECO PRISLO - PREJDI DO STAVU UKLADANI PARAMETRU
370 MOV STAV,#SAVE_PARMS
371 JMP %L(STATE_START)
372 %L(NXT00):
373 )FI
374 ;MOV A,BUFFLEN
375 ;JZ %L(NXT1)
376 ; POKUD MAS NEJAKE DATA V BUFFERU, TAK JE ZPRACUJ - ABY TE NIC NEZDRZOVALO, PREJDI DO DUMMY STAVU
377 ;MOV STAV,#DUMMY_STATE
378 ;CALL CLR_LCD
379 ;JMP %L(STATE_START)
380 %L(NXT1):
381 ;MOV PCKGCNT_LO,#0
382 ;MOV PCKGCNT_HI,#0
383
384 JNB PROTOKOL,%L(00)
385
386 CALL TESTSBITS
387 CALL RWCALLS
388 ;CALL DECODEDDATA
389 %L(00):
390
391 ; KDYZ NENI PRIZNAK, NIC NENASTAVUJ
392 JNB POWERSAVE,%L(SET_LIGHT)
393 ; NACTU SI JAK SE BUDE SETRIT SVIT DISPLEJE (VYPNUTI / POWERSAVE)
394 MOV R0,#0
395 MOV DPTR,#P16 ; VYPINANI DISPLEJE
396 CALL ParGetParm
397 MOV B,#3
398 DIV AB
399 ;MOV DISPPSAVE,B
400 MOV A,B
401 CJNE A,#0,%L(POWSA)
402
403 %L(SET_LIGHT):
404 ; JAKA BUDE SVITIVOST? - NACTU SI DO RAM
405 MOV R0,#0
406 MOV DPTR,#P01 ; NACTU SI SVIT DISPLEJE
407 CALL ParGetParm
408 MOV DISPLIGHT,A
409
410 SJMP %L(POWSX)
411 %L(POWSA):
412 CJNE A,#1,%L(POWSAVE)
413 ; 1 = vypnuti displeje pri POWERSAVE
414 MOV DISPLIGHT,#0 ; VYPNI DISPLEJ
415 SJMP %L(POWSX)
416 %L(POWSAVE):
417 ;neni ani 0 ani 1 -> je 2 = snizeni intenzity
418 MOV DISPLIGHT,#1 ; MINIMALNI SVIT DISPLEJE
419 %L(POWSX):
420
421 ; === TOZ TAK SI GONGNEM
422 ; PRISEL GONG ZE SERIOVKY?
423 JNB GONGSER,%L(GSERXN) ; BUDE?
424 CLR GONGSER ; KAZDOPADNE UZ JE TO VYRIZENO
425 MOV A,POS
426 ANL A,#maskPosValue
427 DEC A
428 MOV R0,A
429 MOV DPTR,#P04 ; TAK JAK JE S TIM GONGEM V TOMO PATRE?
430 CALL ParGetParm
431 JZ %L(GSERXN)
432
433 JB GONGDONEL,%L(GSERX)
434 MOV R0,#0
435 MOV DPTR,#P17 ; Jaka bude delka gongu?
436 CALL ParGetParm
437 MOV GONGTIM,A ; SPUSTIM GONG
438 SETB GONGDONEL
439 JMP %L(GSERX)
440 %L(GSERXN):
441 CLR GONGDONEL
442 %L(GSERX):
443 JNB OVERLOAD,%L(OVERN)
444 ; JE PRETIZENO
445 MOV R0,#0
446 MOV DPTR,#P08
447 CALL ParGetParm
448 JZ %L(OVERX)
449 JB GONGDONEP,%L(OVERX)
450 ; JE NASTAVEN GONG PRI PRETIZENI (P08)
451 MOV R0,#0
452 MOV DPTR,#P17 ; Jaka bude delka gongu?
453 CALL ParGetParm
454 MOV GONGTIM,A ; SPUSTIM GONG
455 SETB GONGDONEP
456 JMP %L(OVERX)
457 %L(OVERN):
458 ; NENI PRETIZENO
459 CLR GONGDONEP
460 %L(OVERX):
461
462 ; TAK JAK JSME S TIM GONGEM?
463 MOV A,GONGTIM ; JESTE MAM GONGAT?
464 JZ %L(GNE)
465
466 MOV A,#O_GONG
467 SETB F0 ; AKTIVUJ VYSTUP GONG
468 CALL SET_OUTP
469 JMP %L(GX)
470 %L(GNE):
471 MOV A,#O_GONG
472 CLR F0 ; DEAKTIVUJ
473 CALL SET_OUTP
474 %L(GX):
475 CALL SETGNGTLAC ; OVLADANI VYSTUPU GONGU TLACITKA
476 ; === SKOK PODLE STAVU NA PRISLUSNY PODPROGRAM
477 %L(STATE_START):
478 MOV A,STAV
479 CJNE A,#LASTSTAV,$+3
480 %JNC(RESET) ; NEPLATNY STAV!
481
482 MOV DPTR,#TABSTAV
483 ADD A,ACC ; 2*A
484 MOV B,A
485 MOVC A,@A+DPTR
486 XCH A,B ; HIGH BYTE ADRESY
487 INC A
488 MOVC A,@A+DPTR ; LOW BYTE
489 MOV DPL,A
490 MOV DPH,B
491 CLR A
492 JMP @A+DPTR ; VYKONEJ DLE STAVU
493
494;==================== DEFINICE STAVOVEHO AUTOMATU =============================
495;=== DEFINICE HLAVICKY - ZACATKU
496%*DEFINE(STAVDEF(NAME))
497(%SET(STAVCNT,%STAVCNT+1)
498; === STAV %STAVCNT ===
499%IF (%LEN(%NAME) GT 0) THEN
500(%NAME EQU %STAVCNT
501S_%NAME:
502 %RESLOCAL )
503FI
504
505 ASTAV SET %STAVCNT
506 _STAVL%RSTR(%STAVCNT,3):
507 MOV STAV,#ASTAV
508)
509
510;=== DEFINICE UKONCENI - VYSKOCENI ZE STAVU
511%*DEFINE(BREAK) (
512 ;JMP MainStavExit
513 JMP MainLoop
514)
515
516;=== DEFINICE UKONCENI - KONCE STAVU
517%*DEFINE(ENDSTAV) (
518%L(%STAVCNT%(X)):
519 ;JMP MainStavExit
520 JMP MainLoop
521)
522
523; === INICIALIZACE
524%SET(STAVCNT,-1)
525; ==============================================================================
526; ============================ STAVOVY AUTOMAT =================================
527; ==============================================================================
528; INICIALIZACE
529%STAVDEF(INIT)
530 %PRINT(#20,#0,'RESET..',RES_HDR)
531 MOV SHIFTCNT1,#100 ; PRED VYHODNOCENIM CEKEJ 500ms
532 CALL KeyInit
533%IF(%NO_COMPILE EQ 1)THEN
534(
535 MOV TEMP,#0
536 ; ZJISTI, JESTLI UZ TAM MAS NECO ZAPSANE
537 MOV DPTR,#0EFFFh
538 MOV R2,#7
539 CALL FLASH_BYTERD
540 JZ %L(WAIT)
541 MOV R3,#0
542 CALL FLASH_BYTEWR
543%STAVDEF()
544 MOV A,TEMP
545 CALL GET_TRANS_CHAR_ ; PREVED OBSAH ACC NA ZOBRAZITELNE ZNAKY
546 MOV R0,A
547 MOV A,#0
548 %CJE(R0,#' ',%L(DO1_))
549 MOV A,R0
550 ADD A,#-32
551 MOV B,#OFFSET ; V Acc MAS HODNOTU ZNAKU
552 MUL AB ; BUDES NASOBIT HODNOTOU OFFSETU (DELKA DANEHO ZNAKU V BAJTECH)
553 ADD A,#LOW(BASE)
554 MOV DPL,A
555 MOV A,B
556 ADDC A,#HIGH(BASE)
557 MOV DPH,A
558
559 %L(DO0_):
560 MOV R2,#7 ; NASTAV STRANKU
561 ;MOV R6,#RES_Y ; SET RESOLUTION
562 ;MOV R5,#RES_X
563 CALL GET_CHAR_DUMMYPIX
564 MOV A,R3
565 SWAP A
566 ORL A,R4
567 %L(DO1_):
568 MOV DPH,#0F1h
569 MOV DPL,TEMP
570 MOV R2,#7
571 MOV R3,A
572 CALL FLASH_BYTEWR
573
574 INC TEMP
575 MOV A,TEMP
576 %CMP(A,#99)
577 JNC %L(WAIT)
578%ENDSTAV
579 %L(WAIT):
580)FI
581
582%STAVDEF()
583 MOV A,SHIFTCNT1
584 JNZ %L(KX)
585 MOV R0,#KEYS+valKeyDn
586 CALL KeyGet
587 JNC %L(K1)
588 MOV STAV,#BEGIN_TEST
589 SJMP %L(KX)
590 %L(K1):
591 MOV R0,#KEYS+valKeyUp
592 CALL KeyGet
593 JNC %L(K2)
594 MOV STAV,#SHOW_VERSION
595 SJMP %L(KX)
596 %L(K2):
597 MOV R0,#KEYS+valKeyMode
598 CALL KeyGet
599 JNC %L(K3)
600 MOV STAV,#MENUSET
601 SJMP %L(KX)
602 %L(K3):
603 MOV POS,#0
604 MOV POSOLD,POS
605 MOV STAV,#INIT_POSITION
606 %L(KX):
607%ENDSTAV
608
609;********************************************************************
610; ZOBRAZENI POLOHY A SMEROVYCH SIPEK
611;********************************************************************
612BMPPOS EQU MENUPTR
613%IF(1)THEN
614(
615 REFRESH EQU DPL1
616)FI
617
618
619%STAVDEF(INIT_POSITION)
620 CALL LCD_INIT
621 ORL POS,#maskPosRefr
622
623 MOV A,ARROW ; UPDATUJ SMEROVE SIPKY
624 SETB ACC.bitArrRefr
625 MOV ARROW,A
626
627 MOV POS_SCROLL,#98
628%IF(1)THEN
629(
630 MOV REFRESH, #100 ; REFRESH PO 10s
631)FI
632
633%STAVDEF(_POSITION)
634
635%IF(1)THEN
636(
637 MOV A,REFRESH
638 JNZ %L(END)
639 MOV STAV,#INIT_POSITION
640 %L(END):
641)FI
642
643 ;=== JAK JE TO S NAPISY MIMO PROVOZ, PRETIZENO A POZARNI JIZDA? ===
644 CALL CheckFlags
645 CJNE A,#valFlgFir,%L(FPSX) ; NENI POZARNI JIZDA - SKOC
646 MOV B,A ; SCHOVAM
647 MOV A,FPSCNT
648 JZ %L(FPSR) ; JESTE TRVA PREPNUTI ZE ZOBRAZENI PJ?
649 ; TAK JESTE NA CHVILI ZUSTAN TADY
650 CLR A
651 SJMP %L(FPSX)
652 %L(FPSR):
653 ; TAK UZ DOPOCITAL, TAKZE ZASE ZPATKY
654 MOV A,B
655 %L(FPSX):
656 JZ %L(POS_NORM)
657 ; NEJAKY TEN TEXT PRECE JEN BUDE...
658 MOV STAV,#SFLAGS
659 %BREAK
660 %L(POS_NORM):
661
662 ; ZJISTIM,JESTLI MAM NASTAVENE NEJAKE SIPKY - POKUD NE, BUDU KRESLIT POLOHU DOPROSTRED DISPLEJE
663 %IF(0)THEN
664 (
665 CLR TEMPBIT2
666 MOV R0,#0
667 %L(CYKL):
668 MOV A,R0
669 PUSH ACC
670 MOV DPTR,#P05
671 CALL ParGetParm
672 MOV B,R0
673 %CMP(A,B)
674 POP ACC
675 MOV R0,A
676 INC R0
677 ORL C,TEMPBIT2 ; V TEMPBIT2 BUDE ULOZEN PRIZNAK,JESTLI JE NEJAKA SIPKA NEBO NENI
678 MOV TEMPBIT2,C
679 CJNE R0,#4,%L(CYKL)
680 )FI
681 ;=== VYPIS SIPKY
682 %L(AR_S):
683 ;JNB(TEMPBIT2,%L(AR_X))
684
685 MOV A,ARROW
686 ;;;;;;;;;;;;;
687 ;JNB ACC.bitArrBlink,%L(ARB0)
688 ;SETB ACC.bitArrRefr
689 ;MOV ARROW,A
690 ;;;;;;;;;;;;;
691 %L(ARB0):
692 %JNB (Acc.bitArrRefr,%L(AR_W))
693
694 CLR ACC.bitArrRefr
695 MOV ARROW,A
696 ; === NASTAVIM UKAZATEL NA TVAR SIPEK
697 ;;;;;;;;
698 JNB DKABNXTGO,%L(ARR_SET) ; MAS SELEKTOVAT SIPKY??
699 JB KABINA,%L(ARR_SET)
700 MOV A,POS ; NACTI AKTUALNI POZICI
701 ADD A,#-1 ; ODECTI "1" KVULI POZICI,KTEROU VYSILA RIDICI SYSTEM
702 ANL A,#00011111b
703 %CJE(A,PATRO,%L(ARR_SET))
704 MOV A,ARROW
705 ANL A,#NOT maskArrValue ; SMAZ SIPKY - NEMAS JE ZOBRAZOVAT
706 MOV ARROW,A
707 %L(ARR_SET):
708 ;;;;;;;;;
709 ;MOV A,ARROW
710 ;JNB ACC.bitArrBlink,%L(AR_BX)
711 ;MOV A,SYSTIMH
712 ;MOV C,ACC.BIT3 ; INTERVAL BLIKANI
713 ;JNC %L(AR_BX)
714 ;SJMP %L(AR_NO)
715 ;;;;;;;;;;
716 %L(AR_BX):
717 MOV A,ARROW
718 ANL A,#maskArrValue
719 CJNE A,#valArrNone,%L(AR_1) ; ZHASNOUT ?
720 %L(AR_NO):
721 ;CLR SIPKADN
722 ;CLR SIPKAUP
723 MOV A,#O_ARRUP
724 CLR F0
725 CALL SET_OUTP
726 MOV A,#O_ARRDN
727 CALL SET_OUTP
728
729 ;JNB(TEMPBIT2,%L(AR_W))
730
731 MOV A,#NO_ARR
732 CALL SHOW_ARROW
733 ;
734 SJMP %L(AR_W)
735 %L(AR_1):
736 CJNE A,#valArrUp,%L(AR_2) ; SIPKA NAHORU ?
737 ;
738 ;CLR SIPKADN
739 ;SETB SIPKAUP
740 MOV A,#O_ARRUP
741 SETB F0
742 CALL SET_OUTP
743 MOV A,#O_ARRDN
744 CLR F0
745 CALL SET_OUTP
746
747 MOV A,#ARR_UP
748 CALL SHOW_ARROW
749 ;
750 SJMP %L(AR_W)
751 %L(AR_2):
752 CJNE A,#valArrDn,%L(AR_3) ; SIPKA DOLU ?
753 ;
754 ;CLR SIPKAUP
755 ;SETB SIPKADN
756 MOV A,#O_ARRUP
757 CLR F0
758 CALL SET_OUTP
759 MOV A,#O_ARRDN
760 SETB F0
761 CALL SET_OUTP
762
763 MOV A,#ARR_DN
764 CALL SHOW_ARROW
765 ;
766 SJMP %L(AR_W)
767 %L(AR_3):
768 CJNE A,#valArrUD,%L(AR_W) ; OBE SIPKY ?
769 ;
770 ;SETB SIPKAUP
771 ;SETB SIPKADN
772 MOV A,#O_ARRUP
773 SETB F0
774 CALL SET_OUTP
775 MOV A,#O_ARRDN
776 CALL SET_OUTP
777
778 MOV A,#ARR_UD
779 CALL SHOW_ARROW
780 ;
781 %L(AR_W):
782 %L(AR_X):
783 ;***********************************************************************
784 ; POKUD TO NEMAS POVOLENO, NEHAZEJ POLOHU NA STRED DISPLEJE
785 MOV R0,#0
786 MOV DPTR,#P02 ; NACTU SI INTERVAL PRO POSUNUTI O BOD
787 CALL ParGetParm
788 JNZ %L(MID_POS) ; JE POVOLENO ZOBRAZOVAT POLOHU NA STREDU DISPLEJE?
789 SETB TEMPBIT2 ; POLOHA VZDY V DRUHE POLOVINE DISPLEJE
790 %L(MID_POS):
791
792
793%IF(0)THEN
794(
795 ;***********************************************************************
796 ; VYPIS POLOHU
797 ; NACTU SI INTERVAL PRO ROLOVANI, KDYZ JE = 0, TAK NASTAV ODROLOVANO
798 MOV R0,#0
799 MOV DPTR,#P02 ; NACTU SI INTERVAL PRO POSUNUTI O BOD
800 CALL ParGetParm
801 %JZ(%L(POS_ROL)) ; BUDE SE ROLOVAT?
802
803 MOV A,POS
804 %JNB(ACC.bitPosRefr,%L(POS_LX)) ; NENI ZMENA - NERES NIC S POLOHOU
805
806 MOV A,POS_SCROLL
807 %CJE(A,#98,%L(NEW))
808 SJMP %L(_START)
809
810 %L(NEW):
811 MOV POS_SCROLL,#0
812 MOV A,POS
813 ANL A,#maskPosValue
814 MOV B,POSOLD
815 ANL B,#maskPosValue
816
817 %CJE(A,B,%L(_START))
818 ; JSOU RUZNE - ZACNI SKROLOVAT
819 MOV BMPPOS,#0
820 JNB ROTATEDISP,%L(_START)
821 MOV BMPPOS,#63
822 %L(_START):
823 MOV A,POS
824 ANL A,#maskPosValue
825 MOV B,POSOLD
826 ANL B,#maskPosValue
827 %LCJE(A,B,%L(DRAW_STAT)) ; POKUD SE ROVNAJI - ZOBRAZ STATICKOU POLOHU
828 %CMP(A,B)
829 MOV TEMPBIT,C ; ULOZ DO POMOCNEHO BITU - USETRIS PRACI SE ZASOBNIKEM
830 ; UKLADAS SMER ROTACE SYMBOLU - SMER JIZDY
831 %XRL(C,ROTATEDISP)
832 MOV A,BMPPOS
833 JNC %L(UP)
834 CLR C
835 SUBB A,POS_SCROLL
836 SJMP %L(_DRAW)
837 %L(UP):
838 ADD A,POS_SCROLL
839 %L(_DRAW):
840 MOV B,A
841 MOV A,POSOLD
842 JNB ROTATEDISP,%L(OFF0_)
843 ;***********************************************************************
844 SETB DENNY_CS1
845 CLR DENNY_CS2
846 %L(OFF0_):
847 ;***********************************************************************
848 CALL SHOW_POSITION ; ZOBRAZ POLOHU - PREDCHOZI STAV
849
850 MOV A,BMPPOS
851
852 MOV C,TEMPBIT
853 %XRL(C,ROTATEDISP)
854 JNC %L(UP1)
855 ADD A,#96
856 CLR C
857 SUBB A,POS_SCROLL
858 SJMP %L(_DRAW1)
859 %L(UP1):
860 ADD A,#-96
861 ADD A,POS_SCROLL
862 %L(_DRAW1):
863 MOV B,A ; NASTAV VYSLEDNOU POSUNUTOU POZICI
864 MOV A,POS
865
866 JNB ROTATEDISP,%L(OFF_)
867 ;***********************************************************************
868 SETB DENNY_CS1
869 CLR DENNY_CS2
870 %L(OFF_):
871 ;***********************************************************************
872 CALL SHOW_POSITION ; ZOBRAZ POLOHU - NOVOU
873
874 ; === INKREMENTUJ POZICI
875 INC POS_SCROLL
876 INC POS_SCROLL
877 ;***********************************************************************
878 MOV A,POS_SCROLL
879
880 CJNE A,#98,%L(TST_END)
881 ANL POS,#NOT maskPosRefr
882 MOV POSOLD,POS
883 %L(TST_END):
884 SETB DENNY_CS1
885 SETB DENNY_CS2
886 SJMP %L(POS_LX)
887 ; **********************************************************************
888)FI
889 %L(POS_ROL):
890 ; TADY SE ZOBRAZUJI POUZE STATICKE SYMBOLY - NEROLUJI
891 MOV A,POS
892 JNB ACC.bitPosRefr,%L(POS_LX) ; NENI ZMENA - NERES NIC S POLOHOU
893
894 %L(DRAW_STAT): ; TADY SKOCIS, POKUD BUDES CHTIT ZOBRAZIT STATICKOU POLOHU (NEROLOVAT)
895 MOV POS_SCROLL,#98
896
897 CLR ACC.bitPosRefr
898 MOV POS,A
899 MOV POSOLD,A
900
901 %L(R0):
902 ; === ZJISTI, JESTLI MAS SMAZAT POLOHU NA STREDU DISPLEJE
903 JB TEMPBIT2,%L(R1)
904 MOV A,#32
905 MOV R0,#96
906 MOV R1,#0
907 MOV R2,#64
908 CALL FULLFILL_LCD
909 MOV B,#63 ; NASTAV POLOHU
910 JB ROTATEDISP,%L(DO) ; JE ROTOVANY DISPLEJ?
911 MOV B,#0 ; NENI
912 SJMP %L(DO)
913
914 %L(R1):
915 ; === VYMAZ PRISLUSNOU CAST DISPLEJE A NASTAV SOURADNICE VYKRESLENI
916 ; SOURADNICE VRACI V B
917 CALL CLEAR_AND_SET_POSITION
918 %L(DO):
919 JNB ROTATEDISP,%L(OFF1_)
920 SETB DENNY_CS1
921 CLR DENNY_CS2
922 %L(OFF1_):
923 MOV A,POS
924 CALL SHOW_POSITION ; ZOBRAZ POLOHU
925 %L(POS_LX):
926
927
928%IF(%NO_COMPILE EQ 1)THEN
929(
930 %STAVDEF()
931 MOV R0,#KEYS+valKeyMode
932 CALL KeyGet
933 JNC %L(KX)
934 DEC STAV
935 %L(KX):
936)FI
937%ENDSTAV
938
939CLEAR_AND_SET_POSITION:
940 JB ROTATEDISP,%L(DO_) ; JE ROTOVANY DISPLEJ?
941 CLR CS1
942 SETB CS2
943 CALL CLR_LCD_
944 MOV B,#0 ; NENI
945 SJMP %L(KX)
946 %L(DO_):
947 SETB CS1
948 CLR CS2
949 CALL CLR_LCD_
950 MOV B,#63 ; NASTAV POLOHU
951 %L(KX):
952RET
953
954;--------------------------- ZOBRAZENI PRIZNAKU --------------------------------
955TXTON_LO EQU MENUPTR3
956TXTON_HI EQU MENUPTR3_
957;*******************************************************************************
958%STAVDEF(SFLAGS)
959 CALL CLR_LCD
960 MOV FPSCNT,#nbrFTime ; KDYBY TO BYLA POZARNI JIZDA
961%STAVDEF(SFLAGS_)
962; JESTE BUDE TRVAT VYPIS TEXTU DAL?
963 CALL CheckFlags
964 MOV B,A
965
966 ; ZJISTI, JESTLI BYLA NEJAKA ZMENA VE FLAGOCH - NENASTAL ZAROVEN JINY STAV
967 %CJE(A,FLAGS_OLD,%L(_NXT))
968 ; BYLA ZMENA - NEJPRVE SMAZ PREDCHOZI OBSAH
969 MOV FLAGS_OLD,A
970 MOV STAV,#SFLAGS
971 %BREAK
972 %L(_NXT):
973 MOV FLAGS_OLD,A
974
975 CJNE A,#valFlgFir,%L(FPSX)
976
977 MOV A,FPSCNT
978 JNZ %L(FPSX)
979 ; TAK NA CHVILI SE ZNOVU PREPNI DO ZOBRAZENI POLOHY
980 MOV FPSCNT,#nbrSTime
981 ; TAK NA CHVILI SE ZNOVU PREPNI DO ZOBRAZENI POLOHY
982 MOV B,#0 ; SMAZU PRIZNAK FIRE
983 %L(FPSX):
984 MOV A,B
985 MOV R3,A ; ULOZIM SI FLAGY
986
987 JNZ %L(SF0)
988 ; UZ NENI CO VYPSAT - JDI ZPATKY K ZOBRAZENI POLOHY A SIPEK
989 MOV STAV,#INIT_POSITION
990 ;
991 ;
992 %BREAK
993 %L(SF0):
994 %L(SF_NZ):
995 MOV B,STAV ; ULOZ AKTUALNI STAV
996 ; NASTAVENI ADRES PRO ZPRACOVANI PARAMETRU + VYRIZENI STAVU, KDY NENI ZADNA HLASKA NEBO BITMAPA
997 MOV A,R3 ; VYZVEDNU SI FLAGY ZNOVU
998 CJNE A,#valFlgFir,%L(SF_F)
999 MOV TXTON_LO,#LOW(P13)
1000 MOV TXTON_HI,#HIGH(P13)
1001 MOV DPTR,#P14 ; ADRESA PARAMETRU PRO POZARNI JIZDU
1002 %L(SF_F):
1003 CJNE A,#valFlgOvl,%L(SF_O)
1004 MOV TXTON_LO,#LOW(P09)
1005 MOV TXTON_HI,#HIGH(P09)
1006 MOV DPTR,#P10 ; ADRESA PARAMETRU PRO PRETIZENO
1007 %L(SF_O):
1008 CJNE A,#valFlgDef,%L(SF_R)
1009 MOV TXTON_LO,#LOW(P11)
1010 MOV TXTON_HI,#HIGH(P11)
1011 MOV DPTR,#P12 ; ADRESA PARAMETRU PRO MIMO PROVOZ
1012 %L(SF_R):
1013 CJNE A,#valFlgRev,%L(SF_R2)
1014 MOV TXTON_LO,#LOW(P18)
1015 MOV TXTON_HI,#HIGH(P18)
1016 MOV DPTR,#P19 ; ADRESA PARAMETRU PRO REVIZNI JIZDU
1017 %L(SF_R2):
1018 CJNE A,#valFlgReklam,%L(SF_D)
1019 MOV TXTON_LO,#LOW(P23)
1020 MOV TXTON_HI,#HIGH(P23)
1021 MOV DPTR,#P24 ; ADRESA PARAMETRU PRO REKLAMU
1022 %L(SF_D):
1023 CJNE A,#valFlgNco,%L(SF_N)
1024 MOV TXTON_LO,#LOW(P06)
1025 MOV TXTON_HI,#HIGH(P06)
1026 MOV DPTR,#P07 ; ADRESA PARAMETRU PRO NEKOMUNIKACI
1027 ;KDYZ NENI KOMUNIKACE, MUSIM SMAZAT PRIZNAKY, ABY PAK TO NEBLBLO
1028 CLR FIRE
1029 CLR OVERLOAD
1030 CLR DEFECT
1031 CLR REVIZE
1032 %L(SF_N):
1033 MOV STAV,B ; DEJ ZPATKY HODNOTU STAVU
1034 ; ULOZ ADRESU PARAMETRU PRO PRIPADNE ZOBRAZENI BEZICIHO TEXTU
1035 MOV ADDR_LO,DPL
1036 MOV ADDR_HI,DPH
1037
1038 ;***********************************************************************
1039 ; TADY OTESTUJ, JESTLI BUDES ZOBRAZOVAT NEJAKY TEXT
1040 MOV BMPCNT,#0 ; NULUJ POCITADLO BITMAP PRO ZOBRAZENI TEXTU
1041
1042 PUSH DPL
1043 PUSH DPH
1044
1045 MOV DPH,TXTON_HI
1046 MOV DPL,TXTON_LO
1047 MOV R0,#0
1048 CALL ParGetParm
1049 JZ %L(NO_)
1050
1051 MOV DPH,ADDR_HI
1052 MOV DPL,ADDR_LO
1053 MOV R0,#2
1054 CALL ParGetParmRaw
1055 %CMP(A,#128)
1056 JNC %L(NO_)
1057 ORL BMPCNT,#80H ; NASTAV PRIZNAK TEXTU
1058 MOV STAV,#ROLL_TEXT ; PREJDI DO STAVU ROLOVANI TEXTU
1059 %L(NO_):
1060 POP DPH
1061 POP DPL
1062
1063 ;***********************************************************************
1064 ; NEJDRIV ZJISTI, JESTLI MAS NEJAKE BITMAPY
1065 MOV R0,#0
1066 CALL ParGetParm
1067
1068 MOV DPL,ADDR_LO
1069 MOV DPH,ADDR_HI
1070 ; ZJISTI, JESTLI NEVRACIS NULL
1071 MOV B,R0
1072 %CMP(A,B)
1073 %JNC(%L(TEST_TEXT)) ; NENI ZADNA BITMAPA
1074
1075 INC BMPCNT ; ZVYS O JEDNA - MAS BITMAPU
1076 ; JE NEJAKA BITMAPA - ZJISTI, JESTLI MAS JESTE DALSI
1077 PUSH ACC ; ULOZ POINTER NA BITMAPU
1078
1079 MOV R0,#1 ; ZKUS NACIST DALSI BITMAPU
1080 CALL ParGetParm
1081 ; ZJISTI, JESTLI NEVRACIS NULL
1082 MOV B,R0
1083 %CMP(A,B)
1084
1085 POP B ; VYTAHNI ZE STACKU POINTER NA 1 BITMAPU
1086 %JC(%L(2BMP))
1087 ;***********************************************************************
1088 ; VYPOCET ADRESY 1 BITMAPY
1089 MOV A,R3
1090 MOV R2,A ; ZADEJ STRANKU PARAMETRU
1091 MOV A,#2
1092 MUL AB
1093 MOV DPH,A
1094 MOV DPL,#0 ; VYPOCITEJ ADRESU BITMAPY Z PARAMETRU
1095 MOV R5,#64 ; NASTAV ROZLISENI
1096 MOV R4,#64
1097 ; ZOBRAZUJES POUZE JEDNU BITMAPU - DLE ROTACE DISPLEJE DEJ VZDY NA STRED
1098 JNB ROTATEDISP,%L(STD0)
1099 ; ZOBRAZ OTOCENE O 90 STUPNU
1100 MOV R7,#0
1101 %IF(0)THEN
1102 (
1103 MOV R6,#95
1104 )ELSE
1105 (
1106 MOV R6,#95
1107 MOV A,BMPCNT
1108 JB ACC.7, %L(00)
1109 ; === NENI TEXT - BUDES ZOBRAZOVAT POLOHU!!
1110 MOV R6,#127
1111 %L(00):
1112 )FI
1113 CLR C
1114 CALL SHOWBMPWND2ROT
1115 SJMP %L(SHOW_POS)
1116 %L(STD0):
1117 %IF(0)THEN
1118 (
1119 MOV R6,#32 ; POKUD NEMAS ZADNY TEXT, ZOBRAZ BITMAPU NA STRED!
1120 MOV A,BMPCNT
1121 JNB ACC.7,%L(STD00)
1122 MOV R6,#0
1123 )ELSE
1124 (
1125 MOV R6,#0
1126 )FI
1127 %L(STD00):
1128 MOV R7,#0
1129 CALL SHOWBMPWND2
1130
1131 %L(SHOW_POS):
1132 %IF(1)THEN
1133 (
1134 MOV A,BMPCNT
1135 JB ACC.7, %L(TEST_TEXT)
1136
1137 MOV A,POS
1138 JNB ACC.bitPosRefr,%L(DO); NENI ZMENA - NERES NIC S POLOHOU
1139
1140 CLR ACC.bitPosRefr
1141 MOV POS,A
1142 MOV POSOLD,A
1143 CALL CLEAR_AND_SET_POSITION
1144
1145 %L(DO):
1146 ; === VYMAZ PRISLUSNOU CAST DISPLEJE A NASTAV SOURADNICE VYKRESLENI
1147 JB ROTATEDISP,%L(DO_) ; JE ROTOVANY DISPLEJ?
1148 MOV B,#0 ; NENI
1149 SJMP %L(KX)
1150 %L(DO_):
1151 MOV B,#63 ; NASTAV POLOHU
1152 %L(KX):
1153
1154 JNB ROTATEDISP,%L(OFF1_)
1155 SETB DENNY_CS1
1156 CLR DENNY_CS2
1157 %L(OFF1_):
1158 SETB TEMPBIT2
1159 MOV A,POS
1160 CALL SHOW_POSITION ; ZOBRAZ POLOHU
1161 )FI
1162 SJMP %L(TEST_TEXT)
1163 ;***********************************************************************
1164 %L(2BMP):
1165 INC BMPCNT ; ZVYS ZASE JEDNA - MAS 2 BITMAPY
1166 ;***********************************************************************
1167 ; ZOBRAZUJES OBE DVE BITMAPY
1168 XCH A,B ; DEJ 1 BITMAPU DO ACC A DRUHOU DO B
1169 PUSH B ; ULOZ
1170 MOV B,A
1171 MOV A,R3
1172 MOV R2,A ; ZADEJ STRANKU PARAMETRU
1173 MOV A,#2
1174 MUL AB
1175 MOV DPH,A
1176 MOV DPL,#0 ; VYPOCITEJ ADRESU BITMAPY Z PARAMETRU
1177 MOV R5,#64 ; NASTAV ROZLISENI
1178 MOV R4,#64
1179 JNB ROTATEDISP,%L(STD1)
1180 ; ZOBRAZ OTOCENE O 90 STUPNU
1181 MOV R7,#0
1182 MOV R6,#127
1183 CLR C
1184 CALL SHOWBMPWND2ROT
1185 SJMP %L(NXTBMP)
1186 %L(STD1):
1187 MOV R7,#0
1188 MOV R6,#0
1189 CALL SHOWBMPWND2
1190 %L(NXTBMP):
1191 ; V R2 STALE ZUSTAVA PLATNA ADRESA STRANKY VE FLASH
1192 POP ACC ; VYTAHNI ZE ZASOBNIKU ADRESU 2. BITMAPY
1193 MOV B,#2
1194 MUL AB
1195 MOV DPH,A
1196 MOV DPL,#0 ; VYPOCITEJ ADRESU BITMAPY Z PARAMETRU
1197 MOV R5,#64 ; NASTAV ROZLISENI
1198 MOV R4,#64
1199 JNB ROTATEDISP,%L(STD2)
1200 ; ZOBRAZ OTOCENE O 90 STUPNU
1201 MOV R7,#0
1202 MOV R6,#63
1203 CLR C
1204 CALL SHOWBMPWND2ROT
1205 SJMP %L(TEST_TEXT)
1206 %L(STD2):
1207 MOV R7,#0
1208 MOV R6,#64
1209 CALL SHOWBMPWND2
1210%IF(0)THEN
1211(
1212 %L(TEST_TEXT):
1213 ;***********************************************************************
1214 ; TADY OTESTUJ, JESTLI BUDES ZOBRAZOVAT NEJAKY TEXT
1215 MOV DPH,TXTON_HI
1216 MOV DPL,TXTON_LO
1217 MOV R0,#0
1218 CALL ParGetParm
1219 JZ %L(NO_TEXT)
1220
1221 MOV DPH,ADDR_HI
1222 MOV DPL,ADDR_LO
1223 MOV R0,#2
1224 CALL ParGetParm
1225 MOV B,R0
1226 %CMP(A,B)
1227 JNC %L(NO_TEXT)
1228 MOV STAV,#ROLL_TEXT ; PREJDI DO STAVU ROLOVANI TEXTU
1229 ; === KONEC
1230)FI
1231 %L(TEST_TEXT):
1232 %L(NO_TEXT):
1233 ANL BMPCNT,#7FH
1234%ENDSTAV
1235
1236;--------------------------- ROLOVANI TEXTU ------------------------------------
1237RES_X EQU 16
1238RES_Y EQU 24
1239OFFSET EQU 48
1240BASE EQU 8000h
1241
1242ADDR_LO EQU MENUPTR
1243ADDR_HI EQU MENUPTR2
1244STR_LEN EQU MENUPTR3
1245STR_PTR EQU MENUPTR3_
1246TEXT_SCROLL EQU MENUPTR4
1247BMPCNT EQU TEMP2 ; POCET BITMAP
1248SHIFT_NXTCH EQU TEMP3
1249AKTUAL_POS EQU TEMP4
1250;*******************************************************************************
1251%STAVDEF(ROLL_TEXT)
1252 ;***********************************************************************
1253 ; ZJISTI DELKU RETEZCE
1254 MOV R0,#2 ; ZACNI CIST 3. BAJT Z PARAMETRU
1255 %L(CYKL):
1256 MOV A,R0
1257 PUSH ACC ; ULOZ POINTER V PARAMETRU
1258 MOV DPL,ADDR_LO ; NACTI ADRESY PARAMETRU, ZE KTEREHO UDES CIST TEXT
1259 MOV DPH,ADDR_HI
1260 CALL ParGetParmRaw
1261 ;MOV B,R0 ; V R0 MAXIMALNI HODNOTA - EOL
1262 %CJE(A,#128,%L(END))
1263 POP ACC
1264 MOV R0,A ; INKREMENTUJ POINTER
1265 INC R0
1266 %CMP(R0,#23) ; ZJISTI,JESTLI UZ NEMAS MAX. DELKU RETEZCE
1267 JC %L(CYKL) ; POKUD ANO, SKONCI
1268 MOV A,R0
1269 SJMP %L(_END)
1270 %L(END):
1271 POP ACC
1272 MOV R0,A
1273 %L(_END):
1274 CJNE A,#2,%L(POK)
1275 MOV STAV,#SFLAGS
1276 %BREAK
1277 %L(POK):
1278 MOV STR_LEN,R0 ; ULOZ DELKU RETEZCE
1279 MOV STR_PTR,#2 ; ZACNI NA NULE
1280
1281 MOV TEXT_SCROLL,#128 ; ZACNI MIMO OBRAZ
1282 MOV SHIFT_NXTCH,#48
1283 JNB ROTATEDISP,%L(R0)
1284 MOV SHIFT_NXTCH,#-16
1285 MOV TEXT_SCROLL,#64 ; ZACNI MIMO OBRAZ
1286 %L(R0):
1287
1288%STAVDEF(ROLL_TEXT1)
1289 MOV AKTUAL_POS,#0
1290 ;***********************************************************************
1291 CALL CheckFlags
1292 JNZ %L(CONT)
1293 MOV STAV,#INIT_POSITION
1294 %BREAK
1295 %L(CONT):
1296 %CJE(A,FLAGS_OLD,%L(CONT1))
1297 MOV STAV,#SFLAGS
1298 %BREAK
1299 %L(CONT1):
1300 ;***********************************************************************
1301 ; POROVNEJ POCITADLO ZNAKU S CELKOVOU DELKOU ZOBRAZOVANEHO RETEZCE
1302 MOV A,STR_PTR
1303 %CMP(A,STR_LEN)
1304 JNC %L(00)
1305 ; JESTE NEJSI NA KONCI RETEZCE
1306
1307 ; ZOBRAZUJES NA VYSKU?
1308 JB ROTATEDISP,%L(__00)
1309 ; ZOBRAZUJES VODOROVNE
1310 MOV A,BMPCNT ; KOLIK MAS ZOBRAZENYCH BITMAP?
1311 JZ %L(LONGTXT) ; ZADNOU - BUDES VYPISOVAT PO CELE DELCE
1312
1313 MOV A,BMPCNT ; KOLIK MAS ZOBRAZENYCH BITMAP?
1314 XRL A,#2 ; MAS OBE DVE NASTAVENE - BUDES TAKY VYPISOVAT PO CELE DELCE
1315 JZ %L(LONGTXT)
1316 ; MAS POUZE JEDNU - BUDES PSAT JEN NA LEVOU PULKU
1317 MOV A,#64
1318 SETB C
1319 SUBB A,SHIFT_NXTCH
1320 CJNE A,TEXT_SCROLL,%L(00) ; ZJISTI, JESTLI SES NEDOSTAL S POZICI ZA DANOU HRANICI
1321 SJMP %L(_00) ; ANO DOSTAL - 1 ZNAK JSEM VYSKROLOVAL - PRIDAM DALSI
1322 %L(LONGTXT):
1323
1324 %L(__00):
1325 MOV A,#0
1326 SETB C
1327 SUBB A,SHIFT_NXTCH
1328 CJNE A,TEXT_SCROLL,%L(00)
1329 %L(_00):
1330 INC STR_PTR ; 1 ZNAK JE MIMO ZOBRAZOVANOU PLOCHU - DOPLN NA KONCI ZOBRAZOVANEHO RETEZCE DALSIM
1331 MOV A,TEXT_SCROLL
1332 ADD A,SHIFT_NXTCH ; POSUN UKAZATEL V TEXTU ZPET KVULI PREDCHOZIMU ZNAKU
1333 MOV TEXT_SCROLL,A
1334 %L(00):
1335 MOV TEMP,STR_PTR ; ULOZ POZICI V RETEZCI
1336
1337 MOV A,STR_PTR
1338 %CMP(A,STR_LEN)
1339 JC %L(DO0)
1340
1341 %L(DO_END):
1342 MOV STAV,#ROLL_TEXT
1343 ;***********************************************************************
1344 JNB FIRE,%L(BREAK) ; KDYZ DOROLUJES POZARNI JIZDU - PREPNI NA ZOBRAZENI POLOHY
1345 MOV STAV,#INIT_POSITION
1346 MOV FPSCNT,#nbrSTime
1347 %L(BREAK):
1348 %BREAK
1349 ;***********************************************************************
1350 %L(DO0):
1351 MOV R4,#0
1352 MOV R3,#0
1353 MOV DPTR,#(' '-32)*OFFSET+BASE
1354 MOV A,TEMP
1355 %CMP(A,STR_LEN)
1356 JNC %L(DO0_)
1357
1358 MOV DPL,ADDR_LO
1359 MOV DPH,ADDR_HI
1360 MOV R0,TEMP
1361 CALL ParGetParmRaw ; V ACC VRACI HODNOTU ZNAKU, V R0 VRACI "EOF"
1362 ;MOV B,R0
1363 MOV R4,#0
1364 MOV R3,#0
1365 MOV DPTR,#(' '-32)*OFFSET+BASE
1366 %CJE(A,#128,%L(DO0_))
1367
1368 CALL GET_TRANS_CHAR ; PREVED OBSAH ACC NA ZOBRAZITELNE ZNAKY
1369 MOV R2,#7 ; NASTAV STRANKU
1370
1371 ADD A,#-32
1372 PUSH ACC
1373
1374 MOV B,#OFFSET ; V Acc MAS HODNOTU ZNAKU
1375 MUL AB ; BUDES NASOBIT HODNOTOU OFFSETU (DELKA DANEHO ZNAKU V BAJTECH)
1376 ADD A,#LOW(BASE)
1377 MOV DPL,A
1378 MOV A,B
1379 ADDC A,#HIGH(BASE)
1380 MOV DPH,A
1381
1382 POP ACC
1383 %CJE(A,#(' '-32),%L(NO_))
1384 %CJE(A,#('!'-32),%L(NO_))
1385 CALL GET_CHAR_DUMMYPIX
1386 %L(NO_):
1387
1388 %L(DO0_):
1389 ; TADY SE RESI MEZERY MEZI JEDNOTLIVYMI ZNAKY
1390 MOV A,TEXT_SCROLL
1391 ADD A,AKTUAL_POS
1392 PUSH ACC
1393
1394 MOV A,AKTUAL_POS
1395 ADD A,#16 ; SIRKA ZNAKU
1396 CLR C
1397 SUBB A,R4
1398 SUBB A,R3
1399 MOV AKTUAL_POS,A
1400
1401 ; ZJISTI, JESTLI MAS VYPOCITAT NOVOU KONSTANTU PRO INKREMENTACI STR_PTR
1402 MOV A,TEMP
1403 CJNE A,STR_PTR,%L(NXT1)
1404 MOV SHIFT_NXTCH,AKTUAL_POS
1405 %L(NXT1):
1406 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1407 MOV B,R4
1408 MOV R0,B
1409 MOV B,R3
1410 MOV R1,B
1411 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1412 POP ACC
1413
1414 MOV R5,#RES_Y ; SET RESOLUTION
1415 MOV R4,#RES_X
1416
1417 JNB ROTATEDISP,%L(DO0__)
1418 CLR C
1419 SUBB A,R3
1420 MOV R7,A ; ZATIM PIS NA NULTY RADEK
1421
1422 ; VE VYSLEDNE FUNKCI TADY BUDE JINA STRANKA
1423 MOV A,TEMP
1424 XRL A,#2
1425 ADD A,#-1
1426 %L(RES0):
1427 ;***********************************************************************
1428 ;TESTUJ NA POCET ZOBRAZENYCH BITMAP A PODLE TOHO NASTAV SOURADNICE TEXTU
1429 MOV R6,#63 ; POKUD NENI ZADNA BITMAPA
1430 MOV A,BMPCNT
1431 JZ %L(01)
1432 MOV R6,#23 ; POKUD JSOU OBE DVE BITMAPY ZOBRAZENE
1433 %L(01):
1434 CALL SHOWBMPWND2ROT_
1435 SJMP %L(CONTINUE)
1436
1437 %L(DO0__):
1438 MOV R6,A ; ULOZ DO PRACOVNIHO REGISTRU
1439 ;***********************************************************************
1440 ;TESTUJ NA POCET ZOBRAZENYCH BITMAP A PODLE TOHO NASTAV SOURADNICE TEXTU
1441 MOV R7,#16 ; POKUD NENI ZADNA BITMAPA
1442 MOV A,BMPCNT
1443 JZ %L(001)
1444 CLR DENNY_CS1
1445 SETB DENNY_CS2
1446 XRL A,#1
1447 JZ %L(001) ; POKUD JE ZOBRAZENA JEDNA BITMAPA
1448 MOV R7,#40 ; POKUD JSOU OBE DVE BITMAPY ZOBRAZENE
1449 SETB DENNY_CS1
1450 SETB DENNY_CS2
1451 %L(001):
1452 ; VE VYSLEDNE FUNKCI TADY BUDE JINA STRANKA
1453 CALL SHOWBMPWND2_
1454 %L(CONTINUE):
1455 MOV B,#64
1456 JB ROTATEDISP,%L(000) ; DLE PRIZNAKU OTOCENI DISPLEJE PORES VYPISOVANY POCET ZNAKU
1457 MOV B,#128
1458 %L(000):
1459 ; IKDYZ MAS TREBA ZOBRAZENE 2 BITMAPY, ALE POKUD ZACINAS CHOVEJ SE STEJNE, JAKO BYS MEL POUZE JEDINOU -
1460 ; JE TO KVULI DELSIM RETEZCUM - PROSTE TO PRESAHOVALO DO ZACATKU DISPLEJE -> AZ DO URCITE POZICE BUDU VYPISOVAT POUZE OMEZENY POCET ZNAKU
1461 INC TEMP
1462
1463 MOV A,AKTUAL_POS
1464 ADD A,TEXT_SCROLL
1465 %CMP(A,B)
1466 JNC %L(DO1)
1467 JMP %L(DO0)
1468 %L(DO1):
1469 DEC TEXT_SCROLL ; ZARID POSUN
1470 %L(END):
1471%IF(%DEBUG NE 0)THEN
1472(
1473%STAVDEF()
1474 MOV R0,#KEYS+valKeyMode
1475 CALL KeyGet
1476 JNC %L(K1)
1477 DEC STAV
1478 %PRINTINT(#70,#0,#3,TEXT_SCROLL,1)
1479 %PRINTINT(#70,#1,#3,STR_PTR,1)
1480 ;PRINTINT(#70,#2,#3,TEMP5,1)
1481 %L(K1):
1482)FI
1483%ENDSTAV
1484
1485%IF(0)THEN
1486(
1487;********************************************************************
1488; ZDE SE ULOZI PRICHOZI PARAMETR
1489;********************************************************************
1490%STAVDEF(SAVE_PARMS)
1491 CALL CLR_LCD ; SMAZ LCD
1492 %PRINT(#0,#0,'> PARAM',SPARM_TXT)
1493 %PRINTLINE(#0,#1)
1494 ;PRINT(#0,#2,'ADDR0=',ADDR_TXT1)
1495 %PRINT(#0,#2,'ADR=',ADDR_TXT2)
1496 %PRINT(#0,#3,'VAL=',VAL_TXT)
1497%STAVDEF()
1498 JNB PARM_RCVD,%L(END)
1499 CLR PARM_RCVD
1500 ; TED ULOZ PARAMETR
1501 MOV R0,#RCVBUFF+1
1502 MOV A,@R0
1503 INC R0
1504 MOV B,@R0
1505 MOV R1,A
1506 MOV R0,#0;RCVBUFF+1
1507 CALL DirectPutParm
1508
1509 ;MOV R0,#RCVBUFF+1
1510 ;MOV A,@R0
1511 ;PRINTINT(#36,#2,#3,A,0)
1512
1513 MOV R0,#RCVBUFF+1
1514 MOV A,@R0
1515 %PRINTINT(#24,#2,#3,A,0)
1516
1517 MOV R0,#RCVBUFF+2
1518 MOV A,@R0
1519 %PRINTINT(#24,#3,#3,A,0)
1520
1521 %L(END):
1522 MOV A,SERTIM
1523 JNZ %L(END_)
1524 JMP RESET
1525 %L(END_):
1526%ENDSTAV
1527)FI
1528
1529;********************************************************************
1530; SMAZ CELOU FLASH
1531;********************************************************************
1532%STAVDEF(ERASE_FLASH)
1533 CALL CLR_LCD
1534 CLR HDR_RCVD ; MUZES ZNOVU DEKODOVAT HLAVICKY
1535 MOV R0,#HEADER+1
1536 MOV A,@R0
1537 INC R0
1538 ORL A,@R0
1539 JNZ %L(KX)
1540
1541 %PRINT(#0,#5,'D_FLASH',ERASE_LBL)
1542 CALL FLASH_ERASE
1543
1544 ; ODESLI ZPRAVU
1545 MOV DPTR,#ERASEOK_MSG
1546 CALL SEND_DATA
1547 %L(KX):
1548 MOV STAV,#DUMMY_STATE
1549%ENDSTAV
1550
1551;********************************************************************
1552; SMAZ VYBRANY SEKTOR VE FLASH
1553;********************************************************************
1554%STAVDEF(ERASE_SECTOR)
1555 CALL CLR_LCD
1556 CLR HDR_RCVD ; MUZES ZNOVU DEKODOVAT HLAVICKY
1557 MOV R0,#HEADER+1
1558 MOV A,@R0
1559 JNZ %L(KX)
1560
1561 MOV R0,#HEADER+2
1562 MOV A,@R0
1563 %PRINTINT(#45,#5,#1,A,0)
1564 %PRINT(#0,#5,'D_SEC',ERASESEC_LBL)
1565
1566 MOV R0,#HEADER+2
1567 MOV A,@R0
1568 CALL FLASH_ERASE_SEC ; V Cy VRACI, JESTLI MAZANI PROBEHLO USPESNE NEBO NE
1569
1570 ; ODESLI ZPRAVU
1571 MOV DPTR,#ERASESECOK_MSG
1572 CALL SEND_DATA
1573 %L(KX):
1574 MOV STAV,#DUMMY_STATE
1575 MOV PCKGCNT_LO,#0
1576 MOV PCKGCNT_HI,#0
1577%ENDSTAV
1578
1579;********************************************************************
1580; ZAPIS PRIJIMANE DATA DO FLASH
1581;********************************************************************
1582CRC8_2 EQU MENUPTR3
1583%STAVDEF(PROGRAM_FLASH)
1584 %PRINT(#0,#5,'>',DATAIN_TXT)
1585 MOV SHIFTCNT1,#200
1586 MOV DATACNT,#0
1587 MOV CRC8,#0
1588 MOV CRC8_2,#0
1589%STAVDEF(PROGRAM_FLASH1)
1590 CALL POP_DATA
1591 JC %L(KX)
1592 MOV R3,A ; TED NACTI DATA
1593
1594 ; POCITEJ PRUBEZNE CRC8
1595 MOV B,CRC8
1596 CALL CALCCRC8
1597 MOV CRC8,B
1598
1599 ; ZAPIS DATA
1600 MOV DPL,DATACNT
1601 MOV R0,#HEADER+1
1602 MOV DPH,@R0
1603 INC R0
1604 MOV A,@R0 ; TED NACTI STRANKU
1605 MOV R2,A
1606 CALL FLASH_BYTEWR ; ZAPIS DO FLASH
1607
1608 ; PROVED ZPETNE CTENI
1609 MOV DPL,DATACNT
1610 MOV R0,#HEADER+1
1611 MOV DPH,@R0
1612 INC R0
1613 MOV A,@R0 ; TED NACTI STRANKU
1614 MOV R2,A
1615 CALL FLASH_BYTERD ; PRECTI Z FLASH
1616
1617 ; POCITEJ PRUBEZNE CRC8 - V Acc MAS DATA NACTENA Z FLASH
1618 MOV B,CRC8_2
1619 CALL CALCCRC8
1620 MOV CRC8_2,B
1621
1622
1623 MOV SHIFTCNT1,#200 ; RESET TIMEOUT
1624 INC DATACNT
1625 MOV A,DATACNT
1626 JNZ %L(END)
1627 MOV TEMP4,#HIGH(DATAWROK_MSG)
1628 MOV TEMP5,#LOW(DATAWROK_MSG)
1629 MOV STAV,#SEND_ACK
1630 SJMP %L(END_)
1631 %L(KX):
1632 %L(END):
1633 %IF(%NO_COMPILE EQ 1)THEN
1634 (
1635 ; TIMEOUT
1636 MOV A,SHIFTCNT1
1637 JNZ %L(END_)
1638 ; ODESLI ZPRAVU
1639 MOV DPTR,#TIMEOUT_MSG
1640 CALL SEND_DATA
1641 CLR HDR_RCVD ; POVOL CTENI A ZPRACOVANI HLAVICEK
1642 MOV STAV,#DUMMY_STATE
1643 )FI
1644 %L(END_):
1645%ENDSTAV
1646
1647%IF(%DEBUG NE 0)THEN
1648(
1649ERR:
1650%STAVDEF(ERR_)
1651 %PRINT(#0,#0,'BUFFER OVERFLOW',OV_ERR_TXT)
1652%STAVDEF()
1653%ENDSTAV
1654)FI
1655
1656%STAVDEF(SEND_ACK)
1657 CALL BARGRAPH_DRAW
1658%STAVDEF()
1659 CALL POP_DATA
1660 JC %L(END) ; JSOU DATA?
1661 PUSH ACC
1662 XRL A,CRC8
1663 CLR C
1664 ADD A,#-1 ; V Cy MAS PRIZNAK TOHO, JESTLI JSOU DATA V PORADKU NEBO NECO NESEDI
1665 ; POKUD Cy=1,TAK ERROR
1666 MOV F0,C ; ULOZ PRIZNAK
1667
1668 POP ACC
1669 ; ZJISTI JESTE,JESTLI TI CRC8 ZE ZPETNE PRECTENYCH DAT Z FLASH
1670 XRL A,CRC8_2
1671 CLR C
1672 ADD A,#-1 ; V Cy MAS PRIZNAK TOHO, JESTLI JSOU DATA V PORADKU NEBO NECO NESEDI
1673 ; POKUD Cy=1,TAK ERROR
1674 ORL C,F0
1675
1676 ; ODESLI ZPRAVU
1677 %IF(0)THEN
1678 (
1679 MOV DPTR,#DATAWRER_MSG
1680 JC %L(00)
1681 MOV DPTR,#DATAWROK_MSG
1682 %L(00):
1683 )ELSE
1684 (
1685 MOV DPL,TEMP5
1686 MOV DPH,TEMP4
1687 JNC %L(00)
1688 ; POSUN SE NA CHYBOVOU ZPRAVU
1689 INC DPTR
1690 INC DPTR
1691 INC DPTR
1692 %L(00):
1693 )FI
1694 CALL SEND_DATA
1695 MOV STAV,#DUMMY_STATE
1696 CLR HDR_RCVD ; POVOL CTENI A ZPRACOVANI HLAVICEK
1697 %L(END):
1698
1699 MOV A,SHIFTCNT1
1700 JNZ %L(END0)
1701 CLR HDR_RCVD ; POVOL CTENI A ZPRACOVANI HLAVICEK
1702 MOV STAV,#INIT_POSITION
1703 %L(END0):
1704%ENDSTAV
1705
1706BARGRAPH_DRAW:
1707 MOV A,PCKGCNT_LO
1708 MOV B,#128
1709 DIV AB
1710 XCH A,B
1711 CALL SET_COLUMN
1712
1713 MOV A,PCKGCNT_LO
1714 MOV B,#128
1715 DIV AB
1716 PUSH ACC
1717
1718 MOV A,PCKGCNT_HI
1719 MOV B,#128
1720 DIV AB
1721 POP B
1722 ADD A,B
1723 CALL SET_PAGE
1724
1725 MOV A,#0FFh
1726 CALL SENDLCDDATA ; iNDIKUJ JEN NA 1. POLOVINU
1727
1728 MOV DPL,PCKGCNT_LO
1729 MOV DPH,PCKGCNT_HI
1730 INC DPTR
1731 MOV PCKGCNT_LO,DPL
1732 MOV PCKGCNT_HI,DPH
1733RET
1734;********************************************************************
1735; ZDE SE ODESLE 256 BAJTU Z FLASH
1736;********************************************************************
1737%STAVDEF(SEND_FLASH)
1738 MOV A,PCKGCNT_LO
1739 ORL A,PCKGCNT_HI
1740 JNZ %L(NO_CLR)
1741 CALL CLR_LCD
1742 %L(NO_CLR):
1743 %PRINT(#0,#5,'<',DATAOUT_TXT)
1744 MOV DATACNT,#0
1745 MOV CRC8,#0
1746 MOV A,#0
1747 CALL SET_COLUMN
1748 MOV A,#0
1749 CALL SET_PAGE
1750
1751 ; POSLI ZPRAVU
1752 MOV DPTR,#DATARDOK_MSG
1753 CALL SEND_DATA
1754 JB WRITE,$ ; DOKUD ZAPISUJES,NIC NEODESILEJ
1755 MOV CRC8,#0
1756%STAVDEF()
1757 ; VSTUP: DPTR - DOLNICH 16 bitu adresy
1758 ; R2 - A18_A17_A16xxxxx - zbyle tri bity adresy
1759 MOV DPL,DATACNT
1760 MOV R0,#HEADER+1
1761 MOV DPH,@R0
1762 INC R0
1763 MOV A,@R0
1764 MOV R2,A
1765 CALL FLASH_BYTERD
1766
1767 CALL SEND_BYTE2
1768 INC DATACNT
1769
1770 MOV A,DATACNT
1771 MOV B,#64
1772 DIV AB
1773 SETB CS1
1774 CLR CS2
1775 CALL SET_PAGE
1776
1777 %IF(%NO_COMPILE EQ 1)THEN
1778 (
1779 MOV A,B
1780 MOV B,#2
1781 DIV AB
1782 XCH A,B
1783 CALL SENDLCDDATA ; iNDIKUJ JEN NA 1. POLOVINU
1784 )FI
1785
1786 MOV A,DATACNT
1787 JNZ %L(END)
1788 ; ODESLAL JSI POSLEDNI BAJT - POVOL OPET CTENI A VRAT SE DO DEFAULTNIHO STAVU
1789 MOV A,CRC8
1790 CALL SEND_BYTE2
1791
1792 CLR HDR_RCVD
1793 MOV STAV,#DUMMY_STATE;INIT_POSITION
1794
1795 CALL BARGRAPH_DRAW
1796 %L(END):
1797%ENDSTAV
1798
1799%STAVDEF(DUMMY_STATE)
1800 MOV SHIFTCNT1,#200 ; 2 SEKUNDY POCKEJ, NEZ PREJDES DO STAVU INIT_POSITION
1801 MOV RETSTAV,#INIT_POSITION
1802%STAVDEF(WAIT)
1803 MOV A,SHIFTCNT1
1804 JNZ %L(END)
1805 MOV STAV,RETSTAV ; VRAT SE ZPET DO ZADANEHO STAVU
1806 MOV PCKGCNT_LO,#0
1807 MOV PCKGCNT_HI,#0
1808 %L(END):
1809%ENDSTAV
1810
1811;********************************************************************
1812; JEDNA SE "NULOVOU" ZPRAVU?
1813;********************************************************************
1814ZERO_MSG:
1815 MOV R0,#HEADER+1
1816 MOV A,@R0
1817 INC R0
1818 ORL A,@R0
1819RET
1820
1821; CEKACI STAV
1822PING_MSG:
1823DB 06, 'O', 'K'
1824
1825RESTART_MSG:
1826DB 10, 'O', 'K'
1827
1828VERSION_MSG:
1829DB 07, 'O', 'K'
1830
1831VERSION_ERR:
1832DB 07, 'E', 'R'
1833
1834%IF(%NO_COMPILE EQ 1)THEN
1835(
1836TIMEOUT_MSG:
1837DB 05, 'T', 'M'
1838)FI
1839
1840ERASEOK_MSG:
1841DB 02, 'O', 'K'
1842
1843ERASESECOK_MSG:
1844DB 03, 'O', 'K'
1845
1846ERASESECER_MSG:
1847DB 03, 'E', 'R'
1848
1849DATAWROK_MSG:
1850DB 01, 'O', 'K'
1851
1852DATAWRER_MSG:
1853DB 01, 'E', 'R'
1854
1855DATARDOK_MSG:
1856DB 04, 'O', 'K'
1857
1858EEPROMRDOK_MSG:
1859DB 09, 'O', 'K'
1860
1861EEPROMWROK_MSG:
1862DB 08, 'O', 'K'
1863
1864EEPROMWRER_MSG:
1865DB 08, 'E', 'R'
1866;********************************************************************
1867; ZAPIS PRIJIMANE DATA DO EEPROM
1868;********************************************************************
1869%STAVDEF(WRITE_E2ROM)
1870 CALL CLR_LCD ; SMAZ LCD
1871 %PRINT(#0,#0,'>PAR',SPARM_TXT)
1872 MOV SHIFTCNT1,#200
1873 MOV DATACNT,#0
1874 MOV CRC8,#0
1875%STAVDEF(WRITE_E2ROM1)
1876 CALL POP_DATA
1877 JC %L(END)
1878 MOV R3,A ; TED NACTI DATA
1879
1880 ; POCITEJ PRUBEZNE CRC8
1881 MOV B,CRC8
1882 CALL CALCCRC8
1883 MOV CRC8,B
1884 MOV CRC8_2,B
1885
1886 ; ZAPIS DATA
1887 MOV R1,#HEADER+1
1888 MOV A,@R1
1889 MOV B,#16
1890 MUL AB ; STRANKUJES PO 16BAJTECH
1891
1892 ADD A,DATACNT
1893 MOV R1,A ; PRICTI OFFSET
1894
1895 MOV R0,#0
1896 MOV B,R3
1897 CALL DirectPutParm ; ZAPIS DATA DO EEPROM
1898
1899 ;CLR TI
1900 ;MOV SBUF,A
1901 ;JNB TI,$
1902 ;CLR TI
1903
1904 MOV SHIFTCNT1,#200 ; RESET TIMEOUT
1905 INC DATACNT
1906 MOV A,DATACNT
1907 CJNE A,#16,%L(END)
1908 ;JNZ %L(END)
1909 MOV TEMP4,#HIGH(EEPROMWROK_MSG)
1910 MOV TEMP5,#LOW(EEPROMWROK_MSG)
1911 MOV STAV,#SEND_ACK
1912 SJMP %L(END_)
1913 %L(END):
1914 ;MOV A,SHIFTCNT1
1915 ;JNZ %L(END_)
1916 ;CLR HDR_RCVD ; POVOL CTENI A ZPRACOVANI HLAVICEK
1917 ;MOV STAV,#INIT_POSITION
1918 %L(END_):
1919%ENDSTAV
1920
1921;********************************************************************
1922; ZAPIS PRIJIMANE DATA DO EEPROM
1923;********************************************************************
1924%STAVDEF(READ_E2ROM)
1925 CALL CLR_LCD
1926 %PRINT(#0,#0,'<PAR',SPARM_LOAD_TXT)
1927 MOV DATACNT,#0
1928 MOV CRC8,#0
1929
1930 ; POSLI ZPRAVU
1931 MOV DPTR,#EEPROMRDOK_MSG
1932 CALL SEND_DATA
1933 JB WRITE,$ ; DOKUD ZAPISUJES,NIC NEODESILEJ
1934 MOV CRC8,#0
1935%STAVDEF(READ_E2ROM1)
1936 MOV R1,DATACNT
1937 MOV R0,#0
1938 CALL DirectGetParm
1939
1940 CALL SEND_BYTE2
1941 INC DATACNT
1942
1943 MOV A,DATACNT
1944 JNZ %L(END)
1945 ; ODESLAL JSI POSLEDNI BAJT - POVOL OPET CTENI A VRAT SE DO DEFAULTNIHO STAVU
1946 MOV A,CRC8
1947 CALL SEND_BYTE2
1948
1949 CLR HDR_RCVD
1950 MOV STAV,#DUMMY_STATE
1951 %L(END):
1952%ENDSTAV
1953
1954;--------------------------- INFO MENU ---------------
1955%STAVDEF(SHOW_VERSION)
1956 CALL CLR_LCD
1957 %PRINT(#0,#0,#TYPE,0)
1958 %PRINTLINE(#0,#1)
1959 %PRINT(#0,#2,#VERZE,0)
1960 %PRINTLINE(#0,#3)
1961 %PRINT(#0,#4,#RELEASE_DATE,0)
1962%STAVDEF()
1963 CALL KeyGetFirst
1964 CJNE A,#(valKeyNShort+valKeyUp),%L(KX)
1965 MOV STAV,#INIT_POSITION
1966 %L(KX):
1967%ENDSTAV
1968
1969
1970TST_TL_SHOW_RSLT:
1971 CLR F0
1972 MOV A,#0
1973 JNC %L(NO_N)
1974 SETB F0
1975 MOV A,#1
1976 %L(NO_N):
1977 ;MOV R1,#42 ; SOURADNICE X
1978 ;MOV R7,#2 ; SOURADNICE Y
1979 ;MOV R6,#1 ; POCET DIGITU
1980 CALL _PRINT_INT ; A VYPIS NA DISPLEJ
1981RET
1982;--------------------------- TEST MENU ---------------
1983%STAVDEF(BEGIN_TEST)
1984 %PRINT(#0, #0,'1.-Tlac.',FIRST_TEST)
1985 %PRINTLINE(#0,#1)
1986
1987 %PRINT(#64,#3,'Tl_DN:',BTN_DN)
1988 %PRINT(#0,#3,'Tl_UP:',BTN_UP)
1989
1990 %PRINT(#0,#2,'B_UP:',CALL_UP)
1991 MOV C,HRVOLN
1992 ; OTESTUJ STISK A VYPIS VYSLEDEK
1993 MOV R1,#36 ; SOURADNICE X
1994 MOV R7,#2 ; SOURADNICE Y
1995 MOV R6,#1 ; POCET DIGITU
1996 CALL TST_TL_SHOW_RSLT
1997
1998 %PRINT(#64,#2,'B_DN:',CALL_DN)
1999 MOV C,HRVOLD
2000 ; OTESTUJ STISK A VYPIS VYSLEDEK
2001 MOV R1,#100 ; SOURADNICE X
2002 MOV R7,#2 ; SOURADNICE Y
2003 MOV R6,#1 ; POCET DIGITU
2004 CALL TST_TL_SHOW_RSLT
2005
2006 ; OTESTUJ TLACITKA PRO OVLADANI MENU
2007 ; TLACITKO DOLU
2008 MOV R0,#KEYS+valKeyDn
2009 CALL KeyGet
2010 MOV R1,#100 ; SOURADNICE X
2011 MOV R7,#3 ; SOURADNICE Y
2012 MOV R6,#1 ; POCET DIGITU
2013 CALL TST_TL_SHOW_RSLT
2014
2015 ; TLACITKO NAHORU
2016 MOV R0,#KEYS+valKeyUp
2017 CALL KeyGet
2018 MOV R1,#36 ; SOURADNICE X
2019 MOV R7,#3 ; SOURADNICE Y
2020 MOV R6,#1 ; POCET DIGITU
2021 CALL TST_TL_SHOW_RSLT
2022
2023 CALL KeyGetFirst
2024 CJNE A,#(valKeyNShort+valKeyMode),%L(KX)
2025 MOV STAV,#TEST_BACKLIGHT
2026 %L(KX):
2027%ENDSTAV
2028
2029; TEST PODSVICENI
2030%STAVDEF(TEST_BACKLIGHT)
2031 CALL CLR_LCD
2032 MOV MENUPTR,#1 ; ZACNES OD NULTEHO VYSTUPU
2033 MOV SHIFTCNT1,#60
2034%STAVDEF()
2035 %PRINT(#0, #0,'2.-Podsv.',SECOND_TEST)
2036 %PRINTLINE(#0,#1)
2037 %PRINT(#0,#2,'Jas=',BCKLIGHLVL_TXT)
2038 %PRINTINT(#48,#2,#1,MENUPTR,1) ; VYPIS AKTUALNI VYSTUP
2039
2040 ; STISK TLACITKA MODE
2041 CALL KeyGetFirst
2042 CJNE A,#(valKeyNShort+valKeyMode),%L(KX)
2043 MOV STAV,#TEST_OUTS
2044 MOV MENUPTR,#4
2045 %L(KX):
2046 MOV A,SHIFTCNT1
2047 JNZ %L(_KX)
2048 MOV SHIFTCNT1,#60
2049 INC MENUPTR
2050 MOV A,MENUPTR
2051 CJNE A,#5,%L(_KX)
2052 MOV MENUPTR,#1
2053 %L(_KX):
2054 MOV DISPLIGHT,MENUPTR
2055%ENDSTAV
2056
2057; TEST VYSTUPU
2058%STAVDEF(TEST_OUTS)
2059 CALL CLR_LCD
2060 MOV MENUPTR,#0 ; ZACNES OD NULTEHO VYSTUPU
2061 MOV SHIFTCNT1,#40
2062%STAVDEF()
2063 %PRINT(#0,#0,'3.-Vyst.',THIRD_TEST)
2064 %PRINTLINE(#0,#1)
2065 %PRINT(#0,#2,'Out ',OUT_TXT)
2066 %PRINTINT(#18,#2,#1,MENUPTR,0) ; VYPIS AKTUALNI VYSTUP
2067
2068 CALL KeyGetFirst
2069 CJNE A,#(valKeyNShort+valKeyMode),%L(KX)
2070 ; STISK TLACITKA UP
2071 ;MOV STAV,#TEST_DISP
2072 MOV STAV,#BEGIN_TEST
2073 CLR F0
2074 SJMP %L(END)
2075 %L(KX):
2076 MOV A,SHIFTCNT1
2077 JNZ %L(KX_)
2078 CLR F0
2079 MOV A,MENUPTR
2080 CALL SET_OUTP
2081
2082 INC MENUPTR
2083 MOV SHIFTCNT1,#40
2084 MOV A,MENUPTR
2085 %CMP(A,#6)
2086 JC %L(KX_)
2087 MOV MENUPTR,#0
2088 %L(KX_):
2089 SETB F0
2090 %L(END):
2091 MOV A,MENUPTR
2092 CALL SET_OUTP
2093%ENDSTAV
2094
2095%IF(%NO_COMPILE EQ 1)THEN
2096(
2097; TEST VYSTUPU
2098%STAVDEF(TEST_DISP)
2099 MOV SHIFTCNT1,#100
2100 MOV MENUPTR,#0
2101 CALL CLR_LCD
2102%STAVDEF()
2103 MOV A,SHIFTCNT1
2104 JNZ %L(00)
2105 ; TED MUZES MAZAT/VYPLNIT DISPLEJ
2106 MOV SHIFTCNT1,#100
2107 MOV A,MENUPTR
2108 JZ %L(01)
2109 CALL FULLFILL_LCD
2110 SJMP %L(_00)
2111 %L(01):
2112 CALL CLR_LCD
2113 %L(_00):
2114 XRL MENUPTR,#0FFh
2115 %L(00):
2116 CALL KeyGetFirst
2117 CJNE A,#(valKeyNShort+valKeyMode),%L(KX)
2118 MOV STAV,#BEGIN_TEST
2119 %L(KX):
2120%ENDSTAV
2121)FI
2122
2123%IF(%NO_COMPILE EQ 1)THEN
2124(
2125; TEST VYSTUPU
2126%STAVDEF(TEST_OUTS)
2127 CALL CLR_LCD
2128 MOV MENUPTR,#0 ; ZACNES OD NULTEHO VYSTUPU
2129%STAVDEF()
2130 %PRINT(#0, #0,'3.-Vystupy',THIRD_TEST)
2131 %PRINTLINE(#0,#1)
2132 %PRINT(#0,#2,'Out =',OUT_TXT)
2133 %PRINTINT(#18,#2,#1,MENUPTR,0) ; VYPIS AKTUALNI VYSTUP
2134 MOV R1,#0
2135 MOV R2,#5
2136
2137 CALL KeyGetFirst
2138 %L(K0):
2139 CJNE A,#(valKeyNShort+valKeyUp),%L(K1)
2140 ; STISK TLACITKA UP
2141 MOV R0,#MENUPTR
2142 CALL INC_PARM_VAL
2143 SJMP %L(K2)
2144 %L(K1):
2145 CJNE A,#(valKeyNShort+valKeyDn),%L(K2)
2146 ; STISK TLACITKA DN
2147 MOV R0,#MENUPTR
2148 CALL DEC_PARM_VAL
2149 %L(K2):
2150 ; TLACITKO NAHORU
2151 MOV R0,#KEYS+valKeyMode
2152 CLR TEMPBIT
2153 CALL KeyGet
2154 CLR F0
2155 MOV A,#0
2156 JNC %L(NoMode)
2157 SETB TEMPBIT
2158 SETB F0
2159 MOV A,#1
2160 %L(NoMode):
2161 MOV R1,#30 ; SOURADNICE X
2162 MOV R7,#2 ; SOURADNICE Y
2163 MOV R6,#1 ; POCET DIGITU
2164 CALL _PRINT_INT ; A VYPIS NA DISPLEJ
2165 %L(KX):
2166 MOV C,TEMPBIT
2167 MOV F0,C
2168 MOV A,MENUPTR
2169 CALL SET_OUTP
2170%ENDSTAV
2171)FI
2172
2173;--------------------------- ZAKLADNI MENU ---------------
2174%STAVDEF(MENUSET)
2175 MOV MENUPTR,#0FFh ; ZACNI OD PARAMETRU 0
2176 CALL CLR_LCD
2177%STAVDEF(MENUSET_)
2178 MOV R1,#0
2179 MOV R2,#MENUMAX-1
2180 MOV R0,#MENUPTR
2181 CALL INC_PARM_VAL
2182
2183 %PRINT(#32,#0,'Nastav. E341',MENU_HDR)
2184 %PRINTLINE(#0,#1)
2185 %PRINT(#42,#2,#STD_PARM,0)
2186 %PRINTLINE(#0,#3)
2187 %PRINTLINE(#0,#6)
2188 %STAVDEF(MENUSET__)
2189 ;***********************************************************************
2190 ; TADY ZOBRAZ CISLO PARAMETRU (NAPR. P01)
2191 MOV A,MENUPTR
2192 CALL GETMENU00 ; V Acc VRACI HODNOTU PARAMETRU
2193 %PRINTINT(#60,#2,#2,A,0)
2194 ;*****************************************************************************
2195 ; TADY ZOBRAZ TEXTOVY POPISEK PARAMETRU
2196 MOV A,MENUPTR
2197 CALL GETMENU00 ; V DPTR VRACI POINTER NA POPIS PARAMETRU
2198 %PRINT(#0,#7,DPTR,0)
2199
2200 MOV A,MENUPTR
2201 CALL GETMENU00 ; V Acc VRACI HODNOTU PARAMETRU
2202 XCH A,B
2203 ANL A,#11100000b
2204 JNZ %L(_00)
2205 ;*****************************************************************************
2206 ; TADY ZOBRAZ CISELNOU HODNOTU PARAMETRU NEBO '...' POKUD JE TO BITMAPOVY PARAMETR
2207 MOV A,MENUPTR
2208 MOV R0,#0
2209 CALL GET_PARM_VAL
2210 %PRINTINT(#55,#4,#3,A,0)
2211 SJMP %L(_01)
2212 %L(_00):
2213 %PRINT(#55,#4,'...',DONT_SHOW)
2214 %L(_01):
2215%STAVDEF()
2216 ;*****************************************************************************
2217 ; TESTUJ NA STISK NEJAKE KLAVESY
2218 MOV R1,#0
2219 MOV R2,#MENUMAX-1
2220
2221 CALL KeyGetFirst
2222 CJNE A,#(valKeyNShort+valKeyUp),%L(K1)
2223 ; STISK TLACITKA UP
2224 MOV R0,#MENUPTR
2225 CALL INC_PARM_VAL
2226 SJMP %L(KX)
2227 %L(K1):
2228
2229 CJNE A,#(valKeyNShort+valKeyDn),%L(K2)
2230 ; STISK TLACITKA DOWN
2231 MOV R0,#MENUPTR
2232 CALL DEC_PARM_VAL
2233 %L(KX):
2234 %PRINTCLEARLINE(#0,#7)
2235 MOV STAV,#MENUSET__
2236 SJMP %L(END)
2237 %L(K2):
2238
2239 CJNE A,#(valKeyNShort+valKeyMode),%L(K3)
2240 ; STISK TLACITKA MODE
2241 MOV A,MENUPTR
2242 CALL GETMENU00 ; V B VRACI TYP PARAMETRU
2243 MOV A,B
2244
2245 CJNE A,#MENUNBR,%L(K2_1)
2246 MOV RETSTAV,#MENUSET_
2247 MOV STAV,#MENUSET_BYTE
2248 MOV MENUPTR2,#0
2249 SJMP %L(END)
2250 %L(K2_1):
2251 CJNE A,#MENUSTNBR,%L(K2_2)
2252 MOV STAV,#MENUSET_STBYTES
2253 MOV MENUPTR2,#0FFh ; POCATECNI POINTER STANICE
2254 SJMP %L(END)
2255 %L(K2_2):
2256 CJNE A,#MENUBMP,%L(K2_3)
2257 MOV TEMP4,#2
2258 MOV STAV,#MENUSET_BMPTXT
2259 SJMP %L(K2_END1)
2260 %L(K2_3):
2261 CJNE A,#MENUSTBMP,%L(K2_4)
2262 MOV STAV,#MENUSET_STBMP
2263 CLR ROTATEDISP
2264 SJMP %L(K2_END0)
2265 %L(K2_4):
2266 CJNE A,#MENUARROWS,%L(K3)
2267 ;MOV STAV,#MENUSET_4BMP
2268 MOV TEMP4,#4
2269 MOV STAV,#MENUSET_BMP
2270 %L(K2_END0):
2271 MOV MENUPTR2,#0 ; POCATECNI POINTER STANICE
2272 %L(K2_END1):
2273 CALL CLR_LCD
2274 %L(K3):
2275 %L(END):
2276%ENDSTAV
2277;--------------------------- NASTAVENI CISELNE HODNOTY PARAMETRU ---------------
2278%STAVDEF(MENUSET_BYTE)
2279 %PUTCH(#42,#2,#' ',0) ; SMAZ SIPKY KOLEM PARAMETRU
2280 %PUTCH(#78,#2,#' ',0)
2281 %PUTCH(#49,#4,#' ',0)
2282 %PUTCH(#74,#4,#' ',0)
2283 %PUTCH(#49,#4,#124+32,0)
2284 %PUTCH(#73,#4,#125+32,0)
2285 MOV A,MENUPTR
2286 MOV R0,MENUPTR2
2287 CALL GET_PARM_VAL
2288 MOV MENUPTR3,A
2289
2290%STAVDEF()
2291 MOV A,MENUPTR
2292 MOV R0,MENUPTR2
2293 CALL GET_PARM_VAL ; NACTI ULOZENOU HODNOTU A POROVNEJ S AKTUALNI
2294
2295 ; ZJISTI, JESTLI SE HODNOTY LISI
2296 MOV R0,MENUPTR3
2297 CALL SET_F0_IF_DIFF
2298 MOV R1,#55 ; SOURADNICE X
2299 MOV R7,#4 ; SOURADNICE Y
2300 MOV R6,#3 ; POCET DIGITU
2301 MOV A,MENUPTR3 ; VLASTNI HODNOTA
2302 CALL _PRINT_INT ; A VYPIS NA DISPLEJ
2303
2304 MOV A,MENUPTR
2305 MOV R0,MENUPTR2
2306 CALL GET_PARM_VAL ; VRACI: V R1 MIN. HODNOTU, V R2 MAX. HODNOTU
2307
2308 CALL KeyGetFirst
2309 CJNE A,#(valKeyNShort+valKeyUp),%L(K1)
2310 ; STISK TLACITKA UP
2311 MOV R0,#MENUPTR3
2312 CALL INC_PARM_VAL
2313 SJMP %L(KX)
2314 %L(K1):
2315 CJNE A,#(valKeyNShort+valKeyDn),%L(K2)
2316 ; STISK TLACITKA DN
2317 MOV R0,#MENUPTR3
2318 CALL DEC_PARM_VAL
2319 SJMP %L(KX)
2320 %L(K2):
2321 CJNE A,#(valKeyNShort+valKeyMode),%L(END)
2322 ; STISK TLACITKA MODE
2323 MOV A,MENUPTR
2324 CALL GETMENU00
2325
2326 MOV DPH,R1
2327 MOV DPL,R2
2328
2329 MOV R0,MENUPTR2
2330 MOV A,MENUPTR3
2331
2332 CALL ParPutParm
2333 MOV STAV,RETSTAV;#MENUSET_STBYTES ; VRAT SE ZPET NA HLAVNI MENU
2334 %PRINTCLEARLINE(#0,#4)
2335 %L(KX):
2336 %L(END):
2337%ENDSTAV
2338
2339;*******************************************************************************
2340; F0 = 1 -> POKUD A <> R0; F0 = 0 -> POKUD A = R0
2341;*******************************************************************************
2342SET_F0_IF_DIFF:
2343 SETB F0 ; PREDPOKLADEJ, ZE SE HODNOTY NEROVNAJI - V TOM PRIPADE VYPIS INVERTOVANE
2344 XRL A,R0
2345 JNZ %L(_01)
2346 CLR F0 ; HODNOTY SE ROVNAJI - VYPIS NORMALNE
2347 %L(_01):
2348RET
2349
2350STAN_HDR:
2351DB 124+32,'S ',125+32,'= ',0
2352;--------------------------- NASTAVENI CISELNYCH HODNOT SKUPINOVEHO PARAMETRU (ZATIM POUZE P04) ---------------
2353%STAVDEF(MENUSET_STBYTES)
2354 %PUTCH(#42,#2,#' ',0)
2355 %PUTCH(#78,#2,#' ',0)
2356 %PRINT(#12,#4,#STAN_HDR,0)
2357 MOV R1,#0
2358 MOV R2,#30
2359 MOV R0,#MENUPTR2
2360 CALL INC_PARM_VAL
2361
2362%STAVDEF(MENUSET_STBYTES2)
2363 %PRINTINT(#24,#4,#2,MENUPTR2,0)
2364 %PRINTINT(#55,#4,#3,MENUPTR3,0)
2365
2366 MOV A,MENUPTR
2367 MOV R0,MENUPTR2
2368 CALL GET_PARM_VAL ; VRACI ADRESU PARAMETRU
2369 MOV MENUPTR3,A
2370 MOV R1,#0 ; MIN. HODNOTA = 0
2371 MOV R2,#30 ; MAX. HODNOTA = 30 (ROZSAH STANIC 0 - 30; HODNOTA 31 JE PRIRAZENA PRO NEZNAME PATRO)
2372
2373 CALL KeyGetFirst
2374 CJNE A,#(valKeyNShort+valKeyUp),%L(K1)
2375 ; STISK TLACITKA UP
2376 MOV R0,#MENUPTR2
2377 CALL INC_PARM_VAL
2378 SJMP %L(KX)
2379 %L(K1):
2380 CJNE A,#(valKeyNShort+valKeyDn),%L(K2)
2381 ; STISK TLACITKA DN
2382 MOV R0,#MENUPTR2
2383 CALL DEC_PARM_VAL
2384 SJMP %L(KX)
2385 %L(K2):
2386 CJNE A,#(valKeyNShort+valKeyMode),%L(K3)
2387 ; STISK TLACITKA MODE
2388 MOV RETSTAV,#MENUSET_STBYTES
2389 MOV STAV,#MENUSET_BYTE
2390 %PUTCH(#12,#4,#' ',0)
2391 %PUTCH(#36,#4,#' ',0)
2392 SJMP %L(END)
2393 %L(K3):
2394 CJNE A,#(valKeyNLong+valKeyMode),%L(KX)
2395 ; ESC
2396 MOV STAV,#MENUSET_ ; VRAT SE ZPET NA HLAVNI MENU
2397 %PRINTCLEARLINE(#0,#4)
2398 SJMP %L(END)
2399 %L(KX):
2400 MOV STAV,#MENUSET_STBYTES2
2401 %L(END):
2402%ENDSTAV
2403
2404; TAHLE FUNKCE PROSTE JEN VYTVORI SPECIFICKE MENU - POUZIVAM DVAKRAT V RUZNYCH STAVECH - TAK AT USETRIM TROCHU PROG.FLASH
2405; VSTUP: ACC: .... POCET PRVKU
2406MAKE_BMP_MENU:
2407 ADD A,#2 ; PRIPOCTI 1 KVULI HLAVICCE A PRVNIMU SEPARATORU
2408 MOV TEMP,A
2409 %PRINTLINE(#0,A)
2410 %PRINTLINE(#0,#1)
2411 %PUTCH(#17,#0,#' ',1)
2412 %PUTCH(#23,#0,#'P',1)
2413 %PUTCH(#41,#0,#' ',1)
2414 MOV A,MENUPTR
2415 CALL GETMENU00 ; V Acc VRACI HODNOTU PARAMETRU
2416 %PRINTINT(#29,#0,#2,A,1) ; ZOBRAZ INVERZNE NAPIS PARAMETRU
2417 %PUTCH(#0,#2,#124+32,0)
2418 %PRINT(#6,#2,'BMP =',BMP_TITLE)
2419 %PUTCH(#54,#2,#125+32,0)
2420
2421 MOV A,#2
2422 MOV MENUPTR2,#0
2423 MOV MENUPTR3,#0
2424 %L(CYKL):
2425 PUSH ACC
2426 %PRINT(#6,A,#BMP_TITLE,0)
2427 POP ACC
2428 PUSH ACC
2429 MOV B,A
2430 CLR C
2431 SUBB A,#1
2432 %PRINTINT(#24,B,#1,A,0) ; ZOBRAZ INVERZNE NAPIS PARAMETRU
2433
2434 MOV A,MENUPTR
2435 MOV R0,MENUPTR2
2436 CALL GET_PARM_VAL
2437
2438 POP B
2439 PUSH B
2440 %PRINTINT(#36,B,#3,A,0)
2441
2442 POP ACC
2443 INC A
2444 INC MENUPTR2
2445 %CMP(A,TEMP)
2446
2447 JC %L(CYKL)
2448 SETB CS2
2449 CLR CS1
2450 CALL CLR_LCD_ ; SMAZ PRAVOU POLOVINU - TAM BUDES VYKRESLOVAT BITMAPY
2451
2452 MOV MENUPTR2,#0
2453 MOV MENUPTR3,#0
2454RET
2455
2456SET_MENU_VAL:
2457 MOV A,MENUPTR
2458 MOV R0,MENUPTR2
2459 CALL GET_PARM_VAL
2460 MOV MENUPTR3,A
2461 MOV A,MENUPTR2
2462 ADD A,#2
2463 MOV B,A
2464 %PRINTINT(#36,A,#3,MENUPTR3,0)
2465RET
2466
2467%RESLOCAL
2468SET_FOCUS_CHARS:
2469 MOV TEMP,B ; ULOZ POCET PRVKU MENU
2470 MOV A,MENUPTR2 ; UKAZATEL NA PRVEK MENU
2471 MOV B,#2 ; ZAKLADNI RADEK
2472 ; POKUD ACC=0, TAK NIC NEDELEJ
2473 JZ %L(END)
2474 ; NASTAV AKTUALNI UKAZATEL NA NOVOU HODNOTU
2475 MOV A,MENUPTR2
2476 ADD A,#2
2477 PUSH ACC
2478 %PUTCH(#0,A,#124+32,0)
2479 POP ACC
2480 PUSH ACC
2481 %PUTCH(#54,A,#125+32,0)
2482 POP ACC
2483
2484 DEC A
2485 PUSH ACC
2486 ; SMAZ VSECHNY UKAZATELE NA HODNOTU, POKUD MAS NEJAKE
2487 %PUTCH(#54,A,#' ',0)
2488 POP ACC
2489 %PUTCH(#0,A,#' ',0)
2490 %L(END):
2491RET
2492
2493; VSTUP: V ACC POCET PRVKU MENU
2494SHIFT_MENU_VAL:
2495 MOV TEMP,A
2496 MOV A,MENUPTR
2497 MOV R0,MENUPTR2
2498 CALL GET_PARM_VAL
2499 PUSH ACC
2500 ; VYPOCITEJ, KAM ZAPISES HODNOTU
2501 MOV B,TEMP
2502 CALL SET_FOCUS_CHARS
2503 MOV A,MENUPTR2
2504 ADD A,#2
2505 MOV B,A
2506 POP ACC
2507
2508 ; ZJISTI, JESTLI SE HODNOTY LISI
2509 MOV R0,MENUPTR3
2510 CALL SET_F0_IF_DIFF
2511 MOV R1,#36 ; SOURADNICE X
2512 MOV R7,B ; SOURADNICE Y
2513 MOV R6,#3 ; POCET DIGITU
2514 MOV A,MENUPTR3 ; VLASTNI HODNOTA
2515 CALL _PRINT_INT ; A VYPIS NA DISPLEJ
2516RET
2517
2518%RESLOCAL
2519DRAW_PARM_BITMAP:
2520 ; === POKUD JSI NA MAXIMU, NIC NEZOBRAZUJ!
2521 MOV A,MENUPTR
2522 MOV R0,MENUPTR2
2523 CALL GET_PARM_VAL
2524 MOV A,MENUPTR3
2525 %CJE(A, AR2, %L(CLEAR_))
2526
2527 CLR C
2528 ADD A,ACC ; ADRESA V Acc*2 = DELKA BITMAPY 256 BAJTU
2529 JNC %L(DRAW)
2530
2531 %L(CLEAR_):
2532 ; JSI MIMO - NEMAS NIC KRESLIT
2533 SETB CS2
2534 CLR CS1
2535 CALL CLR_LCD_ ; SMAZ PRAVOU POLOVINU - TAM BUDES VYKRESLOVAT BITMAPY
2536 SJMP %L(_END)
2537
2538 %L(DRAW):
2539 MOV DPL,#0
2540 MOV DPH,A
2541
2542 MOV A,R3
2543 ;SWAP A
2544 ;RL A
2545 MOV R2,A
2546
2547 MOV R7,#0
2548 MOV R6,#64;MENUPTR2;#36
2549 MOV R5,#64
2550 MOV R4,#64
2551 CALL SHOWBMPWND2
2552 %L(_END):
2553RET
2554
2555;--------------------------- NASTAVENI A VYBER BITMAP ---------------
2556%STAVDEF(MENUSET_BMPTXT)
2557 %PRINT(#14,#5,'*TEXT*',TXT_TITLE)
2558 %PRINT(#23,#6,#DONT_SHOW,0)
2559%STAVDEF(MENUSET_BMP)
2560 MOV A,TEMP4
2561 CALL MAKE_BMP_MENU
2562%STAVDEF(MENUSET_BMP1_)
2563 CALL SET_MENU_VAL
2564%STAVDEF(MENUSET_BMP1)
2565 MOV A,TEMP4
2566 CALL SHIFT_MENU_VAL
2567 CALL DRAW_PARM_BITMAP
2568%STAVDEF()
2569 MOV A,MENUPTR
2570 MOV R0,MENUPTR2
2571 CALL GET_PARM_VAL ; VRACI: V R1 MIN. HODNOTU, V R2 MAX. HODNOTU
2572 ; OBSLUHA TLACITEK UP A DN
2573 MOV TEMP,STAV ; ULOZ AKTUALNI STAV DO TEMPU
2574 MOV STAV,#MENUSET_BMP1 ; POKUD JE STISKLE TLACITKO, MEL BY SE AUTOMAT VRATIT DO TOHOTO STAVU
2575 CALL HANDLE_UD_KEYS
2576 MOV STAV,TEMP
2577 ; KLASICKA OBSLUHA TLACITEK
2578 %L(K2):
2579 CALL KeyGetFirst
2580 CJNE A,#(valKeyNShort+valKeyMode),%L(K3)
2581 ; STISK TLACITKA MODE
2582 MOV A,MENUPTR
2583 CALL GETMENU00
2584
2585 MOV DPH,R1
2586 MOV DPL,R2
2587 MOV R0,MENUPTR2
2588 MOV A,MENUPTR3
2589 CALL ParPutParm
2590
2591 INC MENUPTR2
2592 MOV SHIFTCNT1,#10
2593 MOV STAV,#WAIT
2594 MOV RETSTAV,#MENUSET_BMP1_ ; VRAT SE ZPET NA HLAVNI MENU
2595
2596 MOV A,MENUPTR2
2597 %CMP(A,TEMP4)
2598 JC %L(END)
2599 ; POKUD ZOBRAZUJES VIC JAK 2 BITMAPY, TAK UZ NEMAS MISTO NA TEXTY - CILI SKONCI
2600 %CMP(A,#3)
2601 JNC %L(RET0)
2602
2603 MOV MENUPTR2,#2
2604
2605 ; ASI EDITUJES 2BMP + TEXT -> PREJDI DO STAVU EDITACE TEXTU
2606 MOV RETSTAV,#MENUSET_TXT ; PREJDI DO STAVU EDITACE TEXTU
2607 SETB CS2
2608 CLR CS1
2609 CALL CLR_LCD_
2610 SJMP %L(END)
2611
2612 %L(K3):
2613 CJNE A,#(valKeyNLong+valKeyMode),%L(END)
2614 ; ESC
2615 %L(RET0):
2616 MOV STAV,#MENUSET_ ; VRAT SE ZPET NA HLAVNI MENU
2617 CALL CLR_LCD
2618 SJMP %L(END)
2619 %L(KX):
2620 MOV STAV,#MENUSET_BMP1
2621 %L(END):
2622%ENDSTAV
2623
2624%STAVDEF(MENUSET_TXT)
2625 %PUTCH(#0,#3,#' ',0) ; SMAZ SIPKY U PREDCHOZIHO PARAMETRU
2626 %PUTCH(#54,#3,#' ',0)
2627 %PRINTCLEARLINE(#0,#6) ; VYMAZ RADEK PRED TIM, NEZ TAM BUDES ZOBRAZOVAT TEXT
2628 ;INC MENUPTR2 ; POSUN SE NA DALSI BAJT PARAMETRU
2629 SETB CS2
2630 CLR CS1
2631 CALL CLR_LCD_ ; SMAZ PRAVOU POLOVINU - TAM BUDES VYKRESLOVAT BITMAPY
2632
2633%STAVDEF(MENUSET_TXT1)
2634 MOV MENUPTR4,MENUPTR2
2635 %L(CYKL):
2636 MOV R0,MENUPTR4
2637 MOV A,MENUPTR
2638 CALL GET_PARM_VAL_RAW ; VRACI: V R1 MIN. HODNOTU, V R2 MAX. HODNOTU
2639
2640 PUSH ACC ; ZALOHUJ NACTENOU HODNOTU Z PARAMETRU
2641 MOV A,MENUPTR4 ; VYPOCITEJ OFFSET ZOBRAZENI PISMENA
2642 ADD A,#-2 ; ODECTI HODNOTU 2
2643 MOV B,#6
2644 MUL AB
2645 XCH A,B ; V B MAS AKTUALNI X-OVE SOURADNICE PRO ZOBR. AKT. ZNAKU
2646 POP ACC
2647 PUSH ACC
2648 CALL GET_TRANS_CHAR ; PREVED NA ZOBRAZITELNE ZNAKY
2649 ;ADD A,#32
2650 %PUTCH(B,#6,A,0)
2651 POP ACC
2652 %CJE(A,#128,%L(NXT_STATE)) ; ZJISTI,JESTLI NEVRACIS ZNAK "EOF"
2653
2654 INC MENUPTR4
2655 MOV A,MENUPTR4
2656 %CMP(A,#23)
2657 JC %L(CYKL)
2658 %L(NXT_STATE):
2659 MOV A,MENUPTR2 ; VYPOCITEJ OFFSET ZOBRAZENI PISMENA
2660 ADD A,#-2 ; ODECTI HODNOTU 2
2661 MOV B,#6
2662 MUL AB
2663 MOV MENUPTR4,A
2664
2665 MOV R0,MENUPTR2
2666 MOV A,MENUPTR
2667 CALL GET_PARM_VAL_RAW ; VRACI: V R1 MIN. HODNOTU, V R2 MAX. HODNOTU
2668 MOV MENUPTR3,A
2669%STAVDEF()
2670 ; BLIKEJ KURZOREM
2671 MOV A,SYSTIMH
2672 ANL A,#04h
2673 JZ %L(KURZOR)
2674 MOV A,#' '
2675 SJMP %L(_KURZOR)
2676 %L(KURZOR):
2677 MOV A,#126+32
2678 %L(_KURZOR):
2679 %PUTCH(MENUPTR4,#7,A,0)
2680
2681 MOV R0,MENUPTR2
2682 MOV A,MENUPTR
2683 CALL GET_PARM_VAL_RAW ; VRACI: V R1 MIN. HODNOTU, V R2 MAX. HODNOTU
2684 ; ZJISTI, JESTLI SE HODNOTY LISI
2685 MOV R0,MENUPTR3
2686 CALL SET_F0_IF_DIFF
2687
2688 MOV A,MENUPTR3 ; VLASTNI HODNOTA
2689 CALL GET_TRANS_CHAR ; PREVED NA ZOBRAZITELNE ZNAKY
2690 PUSH ACC
2691 MOV R1,MENUPTR4 ; SOURADNICE X
2692 MOV R7,#6 ; SOURADNICE Y
2693 ;ADD A,#32
2694 MOV R0,A
2695 CALL _PUTCHAR
2696 ; ZOBRAZ NAHLED VYBRANEHO ZNAKU
2697 POP ACC
2698
2699 ADD A,#-32
2700 MOV B,#OFFSET ; V Acc MAS HODNOTU ZNAKU
2701 MUL AB ; BUDES NASOBIT HODNOTOU OFFSETU (DELKA DANEHO ZNAKU V BAJTECH)
2702 ADD A,#LOW(BASE)
2703 MOV DPL,A
2704 MOV A,B
2705 ADDC A,#HIGH(BASE)
2706 MOV DPH,A
2707 MOV R2,#7
2708 MOV R7,#16
2709 MOV R6,#96
2710 MOV R5,#24
2711 MOV R4,#16
2712 CALL SHOWBMPWND2
2713 %L(DIFF_):
2714
2715 MOV R1,#29 ; NASTAV MINIMUM NA PRVNI ZOBRAZITELNY ZNAK Z ASCII
2716 ;MOV R1,#0
2717 MOV R2,#128
2718
2719 ; OBSLUHA TLACITEK UP A DN
2720 CALL HANDLE_UD_KEYS
2721 ; KLASICKA OBSLUHA TLACITEK
2722 %L(K2):
2723 CALL KeyGetFirst
2724 CJNE A,#(valKeyNShort+valKeyMode),%L(K5)
2725 ; STISK TLACITKA MODE
2726 ; REFRESH POSLEDNIHO ZOBRAZENEHO ZNAKU + SMAZANI KURZORU
2727 MOV B,MENUPTR4
2728 MOV A,MENUPTR3
2729 CALL GET_TRANS_CHAR ; PREVED NA ZOBRAZITELNE ZNAKY
2730 ;ADD A,#32
2731 %PUTCH(B,#6,A,0)
2732 MOV B,MENUPTR4
2733 %PUTCH(B,#7,#' ',0)
2734
2735 MOV A,MENUPTR
2736 CALL GETMENU00
2737
2738 MOV DPH,R1
2739 MOV DPL,R2
2740 MOV R0,MENUPTR2
2741 MOV A,MENUPTR3
2742 CALL ParPutParm
2743
2744 MOV A,MENUPTR4
2745 ADD A,#6
2746 MOV MENUPTR4,A
2747
2748 INC MENUPTR2
2749 MOV SHIFTCNT1,#10
2750 MOV STAV,#WAIT
2751
2752 MOV A,MENUPTR3
2753 %CJE(A,#128,%L(K2_)) ; TESTUJ NA UKONCOVACI ZNAK
2754
2755 MOV A,MENUPTR2
2756 %CJE(A,#23,%L(K2_)) ; TESTUJ NA MAXIMALNI DELKU RETEZCE
2757
2758 MOV RETSTAV,#MENUSET_TXT1 ; VRAT SE ZPET NA POCATECNI STAV MENUSET_TXT
2759 SJMP %L(END)
2760 %L(K2_):
2761 CALL CLR_LCD
2762 MOV RETSTAV,#MENUSET_ ; VRAT SE ZPET NA HLAVNI MENU
2763 SJMP %L(END)
2764 %L(K5):
2765 CJNE A,#(valKeyNLong+valKeyMode),%L(KX)
2766 ; ESC
2767 MOV STAV,#MENUSET_ ; VRAT SE ZPET NA HLAVNI MENU
2768 CALL CLR_LCD
2769 %L(KX):
2770 %L(END):
2771%ENDSTAV
2772
2773%RESLOCAL
2774 ; ABYCH USETRIL PAMET PROGRAMU, TAK TADY MAM SPOLECNE OVLADANI TLACITEK U A D V MENU
2775HANDLE_UD_KEYS:
2776 MOV R0,#KEYS+valKeyUP
2777 MOV A,@R0
2778 ;MOV C,ACC.bitKeyPress
2779 ;JNC %L(K1)
2780 JNB ACC.bitKeyPress,%L(K1)
2781 ; DLOUHY STISK TLACITKA UP
2782 MOV R0,#MENUPTR3
2783 CALL INC_PARM_VAL
2784 SJMP %L(DELAY)
2785 %L(K1):
2786 MOV R0,#KEYS+valKeyDN
2787 MOV A,@R0
2788 ;MOV C,ACC.bitKeyPress
2789 ;JNC %L(END_H)
2790 JNB ACC.bitKeyPress,%L(END_H)
2791 ; DLOUHY STISK TLACITKA DN
2792 MOV R0,#MENUPTR3
2793 CALL DEC_PARM_VAL
2794 %L(DELAY):
2795 POP DPL ; UVOLNI NAVRATOVOU ADRESU ZE ZASOBNIKU - UZ JI NEPOTREBUJES
2796 POP DPH
2797 MOV SHIFTCNT1,#10 ; KVULI RYCHLOSTI INKREMENTACE A DEKREMENTACE ZNAKU CHVILI POCKEJ
2798 MOV RETSTAV,STAV ; VRAT SE ZPET NA POCATECNI STAV MENUSET_TXT
2799 MOV STAV,#WAIT
2800 ;JMP MainStavExit
2801 JMP MainLoop
2802 %L(END_H):
2803 RET
2804
2805LCD2 EQU 64
2806
2807;-------- NASTAVENI A VYBER BITMAP PRO JEDNOTLIVE STANICE -----------
2808%STAVDEF(MENUSET_STBMP)
2809 %PRINTLINE(#0,#2)
2810 %PUTCH(#17,#1,#' ',1)
2811 %PUTCH(#23,#1,#'P',1)
2812 %PUTCH(#41,#1,#' ',1)
2813 MOV A,MENUPTR
2814 CALL GETMENU00 ; V Acc VRACI HODNOTU PARAMETRU
2815 %PRINTINT(#29,#1,#2,A,1) ; ZOBRAZ INVERZNE NAPIS PARAMETRU
2816 %PRINTLINE(#0,#4)
2817 %PUTCH(#17,#3,#124+32,0)
2818 %PUTCH(#23,#3,#'S',0)
2819 %PUTCH(#41,#3,#125+32,0)
2820 %L(_END):
2821 SETB CS2
2822 CLR CS1
2823 CALL CLR_LCD_ ; SMAZ PRAVOU POLOVINU - TAM BUDES VYKRESLOVAT BITMAPY
2824%STAVDEF(MENUSET_STBMP2)
2825 MOV A,MENUPTR2
2826 MOV B,#0
2827 SETB TEMPBIT2
2828 CALL SHOW_POSITION
2829
2830 MOV R1,#29
2831 MOV R7,#3
2832 CLR F0
2833 MOV A,MENUPTR2
2834 JZ %L(CHAR)
2835 ; === PRI OSTATNICH STANICICH UKAZ CISLO
2836 MOV R6,#2
2837 DEC A
2838 CALL _PRINT_INT
2839 SJMP %L(_CHAR)
2840 %L(CHAR):
2841 ; === PRI NEZNAMEM PATRE ZOBRAZ POUZE '??'
2842 MOV R0,#'?'
2843 CLR F0
2844 CALL _PUTCHAR
2845 MOV R0,#'?'
2846 ;CLR F0
2847 CALL _PUTCHAR
2848 %L(_CHAR):
2849
2850 MOV A,MENUPTR2
2851 ADD A,ACC
2852 MOV R0,A
2853 MOV A,MENUPTR
2854 CALL GET_PARM_VAL
2855 MOV MENUPTR3,A ; ULOZ HODNOTU PRVNI BITMAPY
2856 PUSH ACC ; ULOZ HODNOTU PRVNIHO PARAMETRU NA STACK
2857 %PRINTINT(#12,#5,#3,A,0) ; ZOBRAZ CISLO BITMAPY 1
2858
2859 MOV A,MENUPTR2
2860 ADD A,ACC
2861 MOV R0,A
2862 MOV A,MENUPTR
2863 INC R0
2864 CALL GET_PARM_VAL
2865
2866 POP B
2867 XCH A,B
2868 %CMP(A,#128)
2869 JNC %L(_00) ; POKUD JE 1.PARAMETR VETSI NEZ 128 (64X64BITMAPY NEBO NIC), DRUHE CISLO UZ NEZOBRAZUJ
2870 XCH A,B
2871 %CMP(A,#192)
2872 JNC %L(_00) ; POKUD JE 1.PARAMETR VETSI NEZ 128 (64X64BITMAPY NEBO NIC), DRUHE CISLO UZ NEZOBRAZUJ
2873 %PRINTINT(#36,#5,#3,A,0) ; ZOBRAZ CISLO BITMAPY 2
2874 %PUTCH(#30,#5,#'-',0)
2875 SJMP %L(__00)
2876 %L(_00):
2877 %PRINT(#30,#5,' ',DEL2BMP_TXT)
2878 %L(__00):
2879 ;***********************************************************************
2880 %L(__END):
2881 MOV R1,#0 ; MIN PATRO
2882 MOV R2,#31 ; MAXPATRO
2883 ; NASTAV MIN A MAX
2884 CALL KeyGetFirst
2885 CJNE A,#(valKeyNShort+valKeyUp),%L(K1)
2886 ; STISK TLACITKA UP
2887 MOV R0,#MENUPTR2
2888 CALL INC_PARM_VAL
2889 SJMP %L(KX)
2890 %L(K1):
2891 CJNE A,#(valKeyNShort+valKeyDn),%L(K2)
2892 ; STISK TLACITKA DN
2893 MOV R0,#MENUPTR2
2894 CALL DEC_PARM_VAL
2895 SJMP %L(KX)
2896 %L(K2):
2897 CJNE A,#(valKeyNShort+valKeyMode),%L(K3)
2898 ; STISK TLACITKA MODE
2899 MOV STAV,#MENUSET_STBMP3
2900 SJMP %L(KX)
2901 %L(K3):
2902 CJNE A,#(valKeyNLong+valKeyMode),%L(K4)
2903 ; ESC
2904 MOV STAV,#MENUSET_ ; VRAT SE ZPET NA HLAVNI MENU
2905 CALL CLR_LCD
2906 %L(K4):
2907 SJMP %L(END)
2908 %L(KX):
2909 SETB CS2
2910 CLR CS1
2911 CALL CLR_LCD_
2912 %PRINTCLEARLINE(#0,#5)
2913 %L(END):
2914%ENDSTAV
2915
2916%STAVDEF(MENUSET_STBMP3)
2917 MOV MENUPTR4,#0 ; UKAZATEL NA POZICI BITMAPY
2918 ; NEJDRIV VYMAZ SIPKY U OZNACENI STANICE
2919 %PUTCH(#17,#3,#' ',0)
2920 %PUTCH(#41,#3,#' ',0)
2921 ; VYPIS SIPKY U PRVNIHO CISLA
2922 %PUTCH(#6,#5,#124+32,0)
2923 %PUTCH(#30,#5,#125+32,0)
2924 MOV A,MENUPTR2
2925 SETB TEMPBIT2
2926 CALL SHOW_POSITION
2927
2928%IF(1)THEN
2929(
2930 MOV A,MENUPTR2
2931 ADD A,ACC
2932 MOV R0,A
2933 MOV A,MENUPTR
2934 CALL GET_PARM_VAL
2935 MOV MENUPTR3,A ; NACTI HODNOTU, KTEROU MAS ULOZENOU V EEPROM
2936)FI
2937
2938 MOV A,MENUPTR2
2939 ADD A,ACC
2940 INC A
2941 MOV R0,A
2942 MOV A,MENUPTR
2943 CALL GET_PARM_VAL
2944 MOV MENUPTR3_,A ; NACTI DALSI HODNOTU, KTEROU MAS ULOZENOU V EEPROM
2945 MOV A,MENUPTR3
2946 %CMP(A,#128)
2947 JNC %L(NXT)
2948 ;CJE(A,#192,%L(NXT))
2949 %PRINTINT(#36,#5,#3,MENUPTR3_,0) ; ZOBRAZ CISLO BITMAPY 2
2950 %L(NXT):
2951 ;***********************************************************************
2952 %L(_END):
2953%STAVDEF(MENUSET_STBMP3_)
2954 MOV A,MENUPTR4
2955 JZ %L(_A) ; POKUD EDITUJES DRUHY OBRAZEK, MAS POVOLENE POUZE HODNOTY
2956 MOV A,MENUPTR3
2957 CJNE A,#191,%L(_A1)
2958 MOV MENUPTR3,#127
2959 SJMP %L(_A)
2960 %L(_A1):
2961 CJNE A,#128,%L(_A)
2962 MOV MENUPTR3,#192
2963 %L(_A):
2964 ; POKUD VYPISUJES HODNOTU PRVNI BITMAPY (ADRESU), TAK PODLE TETO HODNOTY
2965 ; BUDES RIDIT VYPIS DRUHE HODNOTY
2966 MOV A,MENUPTR4
2967 JNZ %L(CONTINUE)
2968 MOV A,MENUPTR3
2969 %CMP(A,#128)
2970 JNC %L(DEL_2TXT)
2971 %PRINTINT(#36,#5,#3,MENUPTR3_,0)
2972 SJMP %L(CONTINUE)
2973 %L(DEL_2TXT):
2974 %PRINT(#36,#5,#DEL2BMP_TXT,0)
2975 %L(CONTINUE):
2976
2977 ; TADY PORES ZOBRAZOVANI OBOU BITMAP
2978 MOV R1,#36
2979 MOV A,MENUPTR4
2980 JNZ %L(SHOW_VAL1) ;ZOBRAZUJES DRUHY ZNAK?
2981 MOV R1,#12
2982 %L(SHOW_VAL1):
2983 MOV R7,#5
2984 MOV R6,#3
2985 MOV A,MENUPTR3
2986 CLR F0
2987 CALL _PRINT_INT
2988 ;***********************************************************************
2989 MOV A,MENUPTR4
2990 %JNZ(%L(2BMP))
2991 ; RES ZOBRAZENI 1. BITMAPY
2992
2993 ; 1. ZJISTI, JESLI JE HODNOTA JINA NEZ 192
2994 MOV A,MENUPTR3
2995 XRL A,#192
2996 JNZ %L(USR_BMP) ;MAS JINOU HODNOTU NEZ 192?
2997 ; NEMAM - ZOBRAZ STANDARD
2998 SETB CS2
2999 CLR CS1
3000 CALL CLR_LCD_
3001 JMP %L(END_BMP)
3002
3003 %L(USR_BMP):
3004 ; 2. ZJISTI, JESTLI NEMAS ZOBRAZIT VELKOU BITMAPU
3005 MOV A,MENUPTR3
3006 %CMP(A,#128)
3007 JC %L(00)
3008 ADD A,#-128
3009 ADD A,ACC
3010 ADD A,#128
3011 CALL SHOWBMP_LARGE
3012 SJMP %L(END_BMP)
3013 %L(00):
3014 ; 3. ZJISTI, JESTLI MAS NA DRUHE POZICI NEJAKOU BITMAPU
3015 MOV A,MENUPTR3_
3016 %CMP(A,#128)
3017 JNC %L(DRAW_)
3018 ; === ZOBRAZ OBE BITMAPY
3019 MOV A,MENUPTR3
3020 CALL SHOWBMP_LEFT
3021
3022 MOV A,MENUPTR3_
3023 CALL SHOWBMP_RIGHT
3024 SJMP %L(END_BMP)
3025
3026 %L(DRAW_):
3027 MOV A,MENUPTR3
3028 CALL SHOWBMP_CENTER
3029 SJMP %L(END_BMP) ; MAS NAKRESLENO - POKRACUJ ZPRACOVANIM TLACITEK
3030 ;***********************************************************************
3031 %L(2BMP):
3032 MOV A,MENUPTR3
3033 %CMP(A,#192)
3034 JC %L(SHOW_2BMP)
3035 MOV A,MENUPTR3_
3036 CALL SHOWBMP_CENTER
3037 SJMP %L(END_BMP)
3038
3039 %L(SHOW_2BMP):
3040 MOV A,MENUPTR3
3041 CALL SHOWBMP_RIGHT
3042
3043 MOV A,MENUPTR3_
3044 CALL SHOWBMP_LEFT
3045 SJMP %L(END_BMP)
3046 %L(01):
3047 %L(SHOW_POS):
3048 MOV A,MENUPTR2
3049 MOV B,#0
3050 SETB TEMPBIT2
3051 CALL SHOW_POSITION
3052 ;***********************************************************************
3053 %L(END_BMP):
3054
3055
3056 MOV R1,#0 ; NASTAV MINIMUM NA PRVNI ZOBRAZITELNY ZNAK Z ASCII
3057 MOV R2,#192
3058 MOV RETSTAV,STAV
3059 MOV STAV,#CLR_DISP
3060
3061 ; OBSLUHA TLACITEK UP A DN
3062 CALL HANDLE_UD_KEYS
3063 MOV STAV,RETSTAV
3064
3065 ; KLASICKA OBSLUHA TLACITEK
3066 %L(K2):
3067 CALL KeyGetFirst
3068 %LCJNE(A,#(valKeyNShort+valKeyMode),%L(K3))
3069 ; STISK TLACITKA MODE
3070 MOV A,MENUPTR
3071 CALL GETMENU00
3072
3073 MOV DPH,R1
3074 MOV DPL,R2
3075
3076 MOV A,MENUPTR2
3077 ADD A,ACC
3078 ADD A,MENUPTR4
3079 MOV R0,A ; VYPOCITEJ, KAM ULOZIT NOVOU HODNOTU PARAMETRU
3080
3081 MOV A,MENUPTR4
3082 ADD A,#-1
3083
3084 MOV A,MENUPTR3
3085 JNC %L(_WR) ; POKUD JE TO PRVNI BITMAPA, TAK ULOZ JAKOUKOLIV HODNOTU
3086 %CMP(A,#128) ; JESTLI JE PRVNI UKLADANY PARAMETR ROVEN NEBO VETSI NEZ 128,SKONCI
3087 JC %L(_WR)
3088 MOV A,#192 ; ZAPIS MAX. HODNOTU
3089 %L(_WR):
3090 CALL ParPutParm
3091
3092 MOV A,MENUPTR3
3093 %CMP(A,#128) ; JESTLI JE PRVNI UKLADANY PARAMETR ROVEN NEBO VETSI NEZ 128,SKONCI
3094 JNC %L(K2__)
3095
3096 MOV A,MENUPTR4
3097 JZ %L(K2_) ; ZKONTROLUJ, JESTLI JSI UZ PROSEL OBE CASTI
3098 %L(K2__):
3099 SJMP %L(_K3)
3100 %L(K2_):
3101 INC MENUPTR4 ; JESTE NASTAVUJES DRUHOU BITMAPU
3102 MOV A,MENUPTR3
3103 MOV MENUPTR3,MENUPTR3_ ; OBE HODNOTY PROHOD - KVULI ZOBRAZENI
3104 MOV MENUPTR3_,A
3105 ; NEJDRIV VYMAZ SIPKY U PRVNIHO CISLA
3106 %PUTCH(#6,#5,#' ',0)
3107 ; VYPIS SIPKY U DRUHEHO CISLA
3108 %PUTCH(#30,#5,#124+32,0)
3109 %PUTCH(#54,#5,#125+32,0)
3110 SJMP %L(KX)
3111 %L(K3):
3112 CJNE A,#(valKeyNLong+valKeyMode),%L(K4)
3113 ; ESC
3114 %L(_K3):
3115 CALL CLR_LCD
3116 MOV STAV,#MENUSET_STBMP ; VRAT SE O UROVEN VYS
3117 ; === PO NAVRATU O UROVEN VYS
3118 MOV R1,#0 ; MIN PATRO
3119 MOV R2,#31 ; MAXPATRO
3120 MOV R0,#MENUPTR2
3121 CALL INC_PARM_VAL
3122 SJMP %L(END)
3123 %L(K4):
3124 SJMP %L(END)
3125 %L(KX):
3126 SETB CS2
3127 CLR CS1
3128 CALL CLR_LCD_
3129 %L(END):
3130%ENDSTAV
3131
3132%STAVDEF(CLR_DISP)
3133 SETB CS2
3134 CLR CS1
3135 CALL CLR_LCD_
3136 MOV STAV,#MENUSET_STBMP3_
3137%ENDSTAV
3138
3139;********************************************************************
3140; ZOBRAZI NA ZADANYCH SOURADNICICH BITMAPU
3141;********************************************************************
3142SHOWBMP_LARGE:
3143 MOV R6,#64 ; X
3144 MOV R7,#0 ; Y
3145 MOV R4,#64
3146 SJMP %L(DRAW_BMP_)
3147
3148SHOWBMP_LEFT:
3149 MOV R6,#64 ; X
3150 MOV R7,#0 ; Y
3151 SJMP %L(DRAW_BMP)
3152
3153SHOWBMP_RIGHT:
3154 MOV R6,#96
3155 MOV R7,#0
3156 SJMP %L(DRAW_BMP)
3157
3158SHOWBMP_CENTER:
3159 MOV R6,#80
3160 MOV R7,#0
3161%L(DRAW_BMP):
3162 MOV R4,#32
3163
3164%L(DRAW_BMP_):
3165 MOV R5,#64
3166 MOV R2,#0
3167 MOV DPH,A
3168 MOV DPL,#0
3169 CALL SHOWBMPWND2
3170RET
3171;* R7 ... POCATECNI BOD Y,OD KTEREHO VYKRESLUJES BITMAPU
3172;* R6 ... POCATECNI BOD X,OD KTEREHO VYKRESLUJES BITMAPU
3173;*
3174;* DPTR ... ADRESA BITMAPY
3175;* R2 ... STRANKA VE FLASHCE
3176;*
3177;* R5 ... RESOLUTION_Y (ZADAVS V PIXELECH)
3178;* R4 ... RESOLUTION_X
3179;*
3180
3181;========================= KONEC STAVOVEHO AUTOMATU ===========================
3182; ==============================================================================
3183LASTSTAV EQU %STAVCNT+1
3184
3185; === TABULKA ADDRES PODPROGRAMU STAVU
3186TABSTAV:
3187%SET(CNT,0)
3188%REPEAT(%STAVCNT+1)
3189 (DW _STAVL%RSTR(%CNT,3)
3190 %SET(CNT,%CNT+1)
3191)
3192
3193; === ZDE SE ODSKAKUJE PO KAZDEM PRUCHODU
3194MainStavExit:
3195 ;JMP MainLoop
3196
3197%RESLOCAL
3198;*******************************************************************************
3199;* UROVEN PRERUSENI CASOVACE 0
3200;* VSTUP : -
3201;* VRACI : -
3202;* MENI : -
3203;* STACK : 8
3204;*******************************************************************************
3205Timer0Us:
3206 PUSH PSW
3207 PUSH ACC
3208 PUSH DPL
3209 PUSH DPH
3210 PUSH AR0
3211 PUSH AR1
3212 PUSH B
3213 ; INDIKUJ TIMER0 INTERUPT
3214 ;SETB P1.6
3215
3216 ; RELOAD TIMER0
3217 CLR TR0 ; ZASTAV NA CHVILI CASOVAC
3218 MOV TL0,#LOW(TTIMER0INT+7) ; DOROVNEJ NA SPRAVNOU HODNOTU
3219 MOV TH0,#HIGH(TTIMER0INT+7)
3220 SETB TR0 ; A OBNOV CASOVANI
3221
3222 MOV A,STAV
3223 %CMP(A,#ERASE_FLASH)
3224 JNC %L(END_) ; JESTLI ZROVNA PRACUJES S EEPROMKOU NEBO FLASHKOU, TAK VESKEROU KOMUNIKACI IGNORUJ!!
3225
3226 ;JB PROTOKOL,%L(MSP3) ; DLE PARAMETRU ZJISTI, KTERY PROTOKOL MAS PROVADET
3227 CALL MSP2_PROCESSING
3228 JNB PROTOKOL,%L(END_) ; DLE PARAMETRU ZJISTI, KTERY PROTOKOL MAS PROVADET
3229 ;SJMP %L(_END)
3230 %L(MSP3):
3231 ;MOV A,STAV
3232 ;CMP(A,#SHOW_VERSION)
3233 ;JNC %L(END_) ; JESTLI ZROVNA PRACUJES S EEPROMKOU NEBO FLASHKOU, TAK VESKEROU KOMUNIKACI IGNORUJ!!
3234 CALL MSP3_PROCESSING ; MSP3 + SERIOVE VOLBY
3235 ;SJMP %L(_END)
3236 %L(END_):
3237 ;SETB P3.6 ; POKUD NECO NASTAVUJES, NESMIS DRZET SBERNICI
3238 %L(_END):
3239 MOV A,DIV10MS
3240 JZ %L(T0_SC2)
3241 DEC DIV10MS
3242 SJMP %L(END)
3243 %L(T0_SC2):
3244 MOV DIV10MS,#nbr10ms ; RELOAD 10ms TMR
3245
3246 MOV R0,#GONGDELAY
3247 CALL DEC_TMR
3248
3249 MOV R0,#SHIFTCNT1
3250 CALL DEC_TMR
3251
3252 ;UPDATE TLACITEK
3253 SETB INP_MODE ; PIN JAKO VSTUP
3254 SETB INP_UP ; PIN JAKO VSTUP
3255 SETB INP_DN ; PIN JAKO VSTUP
3256 MOV R0,#KEYS
3257 MOV C,INP_MODE
3258 CALL KeyUpdate
3259 INC R0
3260 MOV C,INP_UP
3261 CALL KeyUpdate
3262 INC R0
3263 MOV C,INP_DN
3264 CALL KeyUpdate
3265
3266
3267 DEC DIV100MS
3268 MOV A,DIV100MS
3269 JNZ %L(T0_SCX) ; NENI TO JESTE 100ms
3270
3271 MOV DIV100MS,#10 ; A UZ JE...
3272 INC SYSTIMH
3273
3274 %IF(1)THEN
3275 (
3276 ; === OBSLUZ REFRESH DISPLAYE
3277 MOV A,REFRESH
3278 JZ %L(T0_GT3)
3279 DEC REFRESH
3280 %L(T0_GT3):
3281 )FI
3282
3283 ; DALSI DVA CASOVACE
3284 ;DEKREMENTACE CITACE PREPINANI: FIRE <-> POSITION
3285 MOV R0,#FPSCNT
3286 CALL DEC_TMR
3287
3288 %L(VOLPRI):
3289 MOV R0,#VOLBYTMRNPRI
3290 CALL DEC_TMR
3291
3292 ; VOLBY PRIORITNI
3293 MOV R0,#VOLBYTMRDPRI
3294 CALL DEC_TMR
3295
3296 DEC BLINKTLACTMR
3297 MOV A,BLINKTLACTMR
3298 JNZ %L(LED_)
3299 CPL BLINKTLAC
3300 MOV BLINKTLACTMR,#2
3301 %L(LED_):
3302
3303 ; DEKREMENTACE CASOVACE VOLEB
3304 MOV R0,#VOLBYTMR ; NACTI CASOVAC VOLEB
3305 CALL DEC_TMR
3306
3307 ;DEKREMENTACE PLATNOSTI KOMUNIKACE
3308 MOV R0,#SERTIM
3309 CALL DEC_TMR
3310
3311 MOV R0,#SERTIM2
3312 CALL DEC_TMR
3313
3314 ;CASOVAC NECINNOSTI MENU
3315 MOV R0,#MINTMR
3316 CALL DEC_TMR
3317
3318 MOV R0,#GONGTIM
3319 CALL DEC_TMR
3320
3321 %L(T0_SCX):
3322 ; OVLADEJ PODSVICENI DISPLEJE
3323
3324 %L(T0_CTX):
3325 %L(END):
3326 SETB WATCHTMR0 ; NASTAV PRIZNAK, ZE JSI TU BYL!
3327 %L(T0_KEYX):
3328
3329 ; INDIKUJ TIMER0 INTERUPT
3330 ;CLR P1.6 ; SHOD PIN - MUZES TAK MERIT DELKU PRERUSENI
3331
3332 POP B
3333 POP AR1
3334 POP AR0
3335 POP DPH
3336 POP DPL
3337 POP ACC
3338 POP PSW
3339 RETI
3340
3341DEC_TMR:
3342 MOV A,@R0
3343 JZ %L(KO)
3344 DEC @R0
3345 %L(KO):
3346RET
3347
3348Timer2Us:
3349 PUSH PSW
3350 PUSH ACC
3351 CLR TF2
3352 MOV TH2,#HIGH(TTIMER2INT)
3353 MOV TL2,#LOW(TTIMER2INT)
3354 ; SYSTEMOVY CASOVAC
3355 INC SYSTIML
3356 MOV A,SYSTIML
3357 ANL A,#003h ; SNIZENI INTENZITY SVITU DISPLEJE
3358 %CMP(A,DISPLIGHT)
3359 JNC %L(T0_001)
3360 CLR P3.5
3361 SJMP %L(T0_SLX)
3362 %L(T0_001):
3363 SETB P3.5
3364 %L(T0_SLX):
3365 SETB WATCHTMR2 ; NASTAV PRIZNAK, ZE JSI TU BYL!
3366 POP ACC
3367 POP PSW
3368RETI
3369
3370%IF(0)THEN
3371(
3372Timer2Us:
3373 PUSH PSW
3374 PUSH ACC
3375 PUSH B
3376
3377 MOV TH2,#HIGH(TTIMER2INT)
3378 MOV TL2,#LOW(TTIMER2INT)
3379 CLR TF2
3380
3381 INC PWMTIMER
3382 INC SYSTIML
3383
3384 MOV A,DISPLIGHT
3385 %CJE(A,#0,%L(T0_001))
3386
3387 ; NASLEDUJE RIZENI KROKU PODSVETLENI
3388 MOV A,SYSTIML
3389 CJNE A,#03Fh,%L(T0_ENDDL)
3390 MOV SYSTIML,#0
3391
3392 MOV A,DISPLIGHT
3393 ADD A,ACC ; DISPLIGHT * 2
3394 MOV B,A
3395
3396 MUL AB ; (DISPLIGHT*2)^2
3397 MOV B,A
3398 MOV A,DISPLIGHTTEMP
3399 %CMP(A,B)
3400 JNC %L(T0_STM0)
3401 INC DISPLIGHTTEMP
3402 SJMP %L(T0_ENDDL)
3403 %L(T0_STM0):
3404 XCH A,B
3405 %CMP(A,B)
3406 JC %L(DEC)
3407 SJMP %L(T0_ENDDL)
3408 %L(DEC):
3409 DEC DISPLIGHTTEMP
3410 %L(T0_ENDDL):
3411
3412 ; ZRUSENO PWM - VZDY BUDE POUZE 1 PULS - ZKRACOVAT SE BUDE STRIDA (PERIODA)
3413 MOV A,PWMTIMER
3414 JNZ %L(T0_001)
3415 %L(T0_SET):
3416 CLR P3.5 ; SVITI
3417 SJMP %L(T0_SLX)
3418 %L(T0_001):
3419 SETB P3.5 ; NESVITI
3420 %L(T0_SLX):
3421 MOV A,#64
3422 CLR C
3423 SUBB A,DISPLIGHTTEMP
3424 MOV B,A
3425 MOV A,PWMTIMER
3426 ;CJNE A,B,%L(T0_SLX0)
3427 %CMP(A,B)
3428 JC %L(T0_SLX0)
3429 MOV PWMTIMER,#-1
3430 %L(T0_SLX0):
3431
3432 %IF(%DEBUG EQ 2)THEN
3433 (
3434 MOV A,DISPLIGHT
3435 ADD A,ACC
3436 MOV B,A
3437 ; SYSTEMOVY CASOVAC
3438 INC SYSTIML
3439 MOV A,SYSTIML
3440 ANL A,#07h ; SNIZENI INTENZITY SVITU DISPLEJE
3441 %CMP(A,B)
3442 JNC %L(T0_001)
3443 CLR P3.5
3444 SJMP %L(T0_SLX)
3445 %L(T0_001):
3446 SETB P3.5
3447 %L(T0_SLX):
3448 )FI
3449
3450 SETB WATCHTMR2 ; NASTAV PRIZNAK, ZE JSI TU BYL!
3451 %L(END_INT2):
3452 POP B
3453 POP ACC
3454 POP PSW
3455 RETI
3456)FI
3457%RESLOCAL
3458;*******************************************************************************
3459;* FUNKCE NASTAVUJE GONG PRO POTVRZENI VOLBY
3460;* VSTUP: -
3461;* VYSTUP: -
3462;* NICI: Acc,Cy,B,R0
3463;*******************************************************************************
3464SETGNGTLAC:
3465 JNB GONGTLACSTART,%L(ST)
3466 CLR GONGTLACSTART ; ZRUS PRIZNAK GONGU
3467 MOV GONGDELAY,#GngCalDelay ; SPUSTIM GONG
3468 MOV A,#O_GNGTL
3469 SETB F0
3470 CALL SET_OUTP
3471%L(ST):
3472 MOV A,GONGDELAY
3473 JNZ %L(_END)
3474 MOV A,#O_GNGTL
3475 CLR F0
3476 CALL SET_OUTP
3477%L(_END):
3478RET
3479
3480;*******************************************************************************
3481;* KONTROLA FLAGU A ZASLANI VYSLEDKU
3482;* VSTUP : -
3483;* VRACI : A - HODNOTA AKCE (0- NORMAL | 1- POZAR | 2- PRETIZ | 4- MIMO PROVOZ | 5- REVIZE)
3484;* MENI : A
3485;* STACK : 0
3486;*******************************************************************************
3487CheckFlags:
3488 ;=== KONTROLA KOMUNIKACE ===
3489 MOV A,SERTIM
3490 JNZ %L(NOCX)
3491 ; KOMUNIKACE - NENI!
3492 ;
3493 ANL WCALLS,#NOT _WVOLBAN OR _WVOLBAD
3494 ; SMAZ VOLBY
3495 MOV A,#O_DN
3496 CLR F0
3497 CALL SET_OUTP
3498 MOV A,#O_UP
3499 CALL SET_OUTP
3500 ;
3501 MOV A,#valFlgNco
3502 SJMP %L(CHFLX)
3503 %L(NOCX):
3504 ;=== KONTROLA REVIZNI JIZDY ===
3505 JNB REVIZE,%L(REVIZEX)
3506 JNB TREVIZE,%L(REVIZEX)
3507 ; REVIZNI JIZDA - JE!
3508 ;
3509 ;
3510 MOV A,#valFlgRev
3511 SJMP %L(CHFLX)
3512 %L(REVIZEX):
3513
3514 ;=== KONTROLA MIMO PROVOZ ===
3515 JNB DEFECT,%L(DEFEX)
3516 JNB TDEFECT,%L(DEFEX)
3517 ; MIMO PROVOZ - JE!
3518 ;
3519 ;
3520 MOV A,#valFlgDef
3521 SJMP %L(CHFLX)
3522 %L(DEFEX):
3523 ;=== KONTROLA PRETIZENI ===
3524 JNB OVERLOAD,%L(OVERX)
3525 JNB TOVERLOAD,%L(OVERX)
3526 ; PRETIZENO - JE!
3527 ;
3528 ;
3529 MOV A,#valFlgOvl
3530 SJMP %L(CHFLX)
3531 %L(OVERX):
3532
3533 ;=== KONTROLA POZARNI JIZDY ===
3534 JNB FIRE,%L(FIREX)
3535 JNB TFIRE,%L(FIREX)
3536 ; POZARNI JIZDA - JE!
3537 ;
3538 ;
3539 MOV A,#valFlgFir
3540 SJMP %L(CHFLX)
3541 %L(FIREX):
3542 MOV DPTR,#P16
3543 MOV R0,#0
3544 CALL ParGetParm
3545 %CMP(A,#3)
3546 JC %L(LCDOFFEX)
3547 ;=== KONTROLA VYPNUTI DISPLEJE - PRIZNAK REKLAMY ===
3548 JNB POWERSAVE,%L(LCDOFFEX)
3549 JNB TREKLAMA,%L(LCDOFFEX) ; POUZE, KDYZ MAS AKTIVOVANY PRIZNAK
3550 ; POZARNI JIZDA - JE!
3551 ;
3552 ;
3553 MOV A,#valFlgReklam
3554 SJMP %L(CHFLX)
3555 %L(LCDOFFEX):
3556 ;=== NORMALNI REZIM - NIC SE NEDEJE ! ===
3557 MOV A,#0
3558 %L(CHFLX):
3559 RET
3560
3561%RESLOCAL
3562;*******************************************************************************
3563;* OBNOVI HW RESET
3564;* VSTUP : -
3565;* VRACI : -
3566;* MENI : A,C
3567;* STACK : 3
3568;*******************************************************************************
3569WdgReset:
3570 CLR EA
3571 ; ZJISTI, JESTLI JSI PROBEHL PRERUSENIMI
3572 MOV C,WATCHTMR0
3573 %IF(%NO_COMPILE EQ 0)THEN
3574 (
3575 ANL C,WATCHTMR2
3576 )FI
3577 ; POKUD NEJSOU OBE DVE, TAK NEKRM PEJSKA
3578 JNC %L(END)
3579 CLR WATCHTMR0 ; SMAZ HLIDACI PRIZNAKY
3580 CLR WATCHTMR2
3581 ; VSE OK - NAKRM PEJSKA
3582 MOV WDTRST,#01Eh ; AKTIVUJ WDG
3583 MOV WDTRST,#0E1h
3584 %L(END):
3585 SETB EA
3586 RET
3587
3588;*******************************************************************************
3589;* INICIALIZACE TLACITEK
3590;* VSTUP : -
3591;* VRACI : -
3592;* MENI : -
3593;* STACK : 1
3594;*******************************************************************************
3595KeyInit:
3596 PUSH ACC
3597 MOV A,R0
3598 MOV R0,#KEYS
3599 %L(KeyInit1):
3600 MOV @R0,#00
3601 INC R0
3602 CJNE R0,#(KEYS+KEYS_LEN),$+3 ; POZOR !!!!! - RO NESMI PRETECT
3603 JC %L(KeyInit1)
3604 MOV R0,A
3605 POP ACC
3606 RET
3607
3608;*******************************************************************************
3609;* NACTE TLACITKA
3610;* VSTUP : R0 - UKAZATEL NA STATUS TLACITKA
3611;* C - STISK TLACITKA (C=0 - TLACITKO STISKLE)
3612;* VRACI : -
3613;* MENI : A,C
3614;* STACK : 4
3615;*******************************************************************************
3616KeyUpdate:
3617 MOV A,@R0
3618 CLR ACC.bitKeyPress
3619 MOV @R0,A
3620 JC %L(KUpdateX) ; NENI STISKLA - SKOC
3621 MOV A,@R0
3622 ANL A,#maskKeyValue ; JEN CITAC STISKU
3623 CJNE A,#nbrKeyMax,$+3 ; MUZU JESTE PRICITAT ?
3624 JNC %L(KUpdate1) ; NE - SKOC
3625 INC @R0
3626 %L(KUpdate1):
3627 MOV A,@R0
3628 ANL A,#maskKeyValue ; JEN CITAC STISKU
3629 CJNE A,#nbrKeyFilter,$+3 ; PLATNY STISK ?
3630 JC %L(KUpdateX) ; NE - SKOC
3631 MOV A,@R0
3632 SETB ACC.bitKeyPress
3633 JB ACC.bitKeyLock,%L(KUpdate2) ; KLAVESA ZAMCENA - SKOC
3634 CALL KeyLockA ; ZAMCI VSECHNY (SEBE ULOZIM DALE)
3635 %L(KUpdate2):
3636 MOV @R0,A
3637 %L(KUpdateX):
3638 RET
3639
3640;*******************************************************************************
3641;* VRATI UDALOST TLACITEK (PRVNI STISKLE TLACITKO)
3642;* VSTUP : -
3643;* VRACI : A - UDALOST (AKTUALNI)
3644;* C - STISK KLAVESY (C=1 : ANO)
3645;* MENI : A,B,C,R0
3646;* STACK : 5
3647;*******************************************************************************
3648KeyGetFirst:
3649 MOV R0,#KEYS
3650
3651 %L(KGetF01):
3652 MOV A,@R0
3653 JB ACC.bitKeyLock,%L(KGetF02)
3654 CALL KeyGet
3655 SJMP %L(KGetFX)
3656
3657 %L(KGetF02):
3658 INC R0
3659 CJNE R0,#(KEYS+KEYS_LEN),$+3 ; POZOR !!!!! - RO NESMI PRETECT
3660 JC %L(KGetF01)
3661 MOV A,#valKeyNone
3662
3663 %L(KGetFX):
3664 RET
3665
3666;*******************************************************************************
3667;* VRATI UDALOST TLACITKA
3668;* VSTUP : R0 - UKAZATEL NA TLACITKO
3669;*
3670;* VRACI : A - UDALOST (AKTUALNI)
3671;* C - STISK KLAVESY (C=1 : ANO)
3672;* MENI : A,B,C
3673;* STACK : 3
3674;*******************************************************************************
3675KeyGet:
3676 MOV A,@R0
3677 ANL A,#maskKeyValue
3678 CJNE A,#nbrKeyShort,$+3
3679 JC %L(KGet1X)
3680 MOV A,R0
3681 SUBB A,#KEYS
3682 MOV B,A
3683 MOV A,@R0
3684 MOV C,ACC.bitKeyPress
3685 MOV A,#valKeyPLong
3686 JC %L(KGet11)
3687 MOV A,#valKeyNLong
3688 CALL KeyInit
3689 CLR C
3690 %L(KGet11):
3691 ORL A,B
3692 SJMP %L(KGetX)
3693 %L(KGet1X):
3694
3695 CJNE A,#nbrKeyFilter,$+3
3696 JC %L(KGet2X)
3697 MOV A,R0
3698 SUBB A,#KEYS
3699 MOV B,A
3700 MOV A,@R0
3701 MOV C,ACC.bitKeyPress
3702 MOV A,#valKeyPShort
3703 JC %L(KGet21)
3704 MOV A,#valKeyNShort
3705 CALL KeyInit
3706 CLR C
3707 %L(KGet21):
3708 ORL A,B
3709 SJMP %L(KGetX)
3710 %L(KGet2X):
3711
3712 MOV A,#valKeyNone
3713 CLR C
3714 %L(KGetX):
3715 RET
3716;*******************************************************************************
3717;* ZAMCE VSECHNY TLACITKA
3718;* VSTUP : -
3719;* VRACI : -
3720;* MENI : C
3721;* STACK : 2
3722;*******************************************************************************
3723KeyLockA:
3724 PUSH ACC
3725 PUSH B
3726 MOV B,R0
3727 MOV R0,#KEYS
3728 %L(KeyLock1):
3729 MOV A,@R0
3730 SETB ACC.bitKeyLock
3731 MOV @R0,A
3732 INC R0
3733 CJNE R0,#(KEYS+KEYS_LEN),$+3 ; POZOR !!!!! - RO NESMI PRETECT
3734 JC %L(KeyLock1)
3735 MOV R0,B
3736 POP B
3737 POP ACC
3738 RET
3739
3740;*******************************************************************************
3741;* TABULKY PRIRAZENI VYSTUPU
3742;*******************************************************************************
3743
3744;*******************************************************************************
3745;*******************************************************************************
3746;** POMOCNE FUNKCE PRO PRACI S MENU
3747;*******************************************************************************
3748;*******************************************************************************
3749%RESLOCAL
3750;*******************************************************************************
3751;* INKREMENTUJE CISLO ULOZENE NA NEJAKE ADRESE A TESTUJE ZDA NEPREKROCI ZADANE MEZE
3752;* VSTUP : R0 = ADRESA BAJTU, VE KTEREM JE ULOZENA AKTUALNI HODNOTA
3753;* R2 = MAX. HODNOTA
3754;* R1 = MIN. HODNOTA
3755;* VYSTUP: R0 = NA ADRESE ULOZENE V REGISTRU JE AKTUALNI HODNOTA PO INKREMENTACI
3756;* MENI : A, B, C
3757;* STACK : 0
3758;*******************************************************************************
3759INC_PARM_VAL:
3760 INC @R0
3761 MOV A,@R0
3762 MOV B,R2
3763 INC B
3764 %CMP(A,B)
3765 JNC %L(00)
3766 SJMP %L(END)
3767 %L(00):
3768 MOV A,R1
3769 MOV @R0,A ; POKUD JE VETSI NEZ MAX., TAK POSUN NA HODNOTU MIN.
3770 %L(END):
3771RET
3772
3773%RESLOCAL
3774;*******************************************************************************
3775;* DEKREMENTUJE CISLO ULOZENE NA NEJAKE ADRESE A TESTUJE ZDA NEPREKROCI ZADANE MEZE
3776;* VSTUP : R0 = ADRESA BAJTU, VE KTEREM JE ULOZENA AKTUALNI HODNOTA
3777;* R2 = MAX. HODNOTA
3778;* R1 = MIN. HODNOTA
3779;* VYSTUP: R0 = NA ADRESE ULOZENE V REGISTRU JE AKTUALNI HODNOTA PO DEKREMENTACI
3780;* MENI : A, B, C
3781;* STACK : 0
3782;*******************************************************************************
3783DEC_PARM_VAL:
3784 DEC @R0
3785 MOV A,@R0
3786 MOV B,R1
3787 CJNE A,B,%L(01)
3788 SJMP %L(END)
3789 %L(01):
3790 JNC %L(02)
3791 %L(01_):
3792 MOV A,R2
3793 MOV @R0,A ; POKUD JE MENSI NEZ MIN., TAK POSUN NA HODNOTU MAX.
3794 SJMP %L(END)
3795 %L(02):
3796 ; OTESTUJ JESTE MOZNOST, ZE JSI PODTEKL NA HODNOTU 255
3797 MOV B,R2
3798 INC B
3799 %CMP(A,B)
3800 JNC %L(01_)
3801 %L(END):
3802RET
3803
3804;*******************************************************************************
3805;* FUNKCE PREVEDE CISLO NA CHAR DLE PREVODNI TABULKY V BMP.A51
3806;* VSTUP : A = CISLO Z PARAMETRU V ROZSAHU 29 - 128
3807;* A = CISLO Z PARAMETRU V ROZSAHU 0 - 99
3808;* VYSTUP: A = ODPOVIDAJICI ZNAK
3809;* MENI : A, B, C
3810;* STACK : 0
3811;*******************************************************************************
3812GET_TRANS_CHAR:
3813;IF(%NO_COMPILE NE 0)THEN
3814;(
3815 ADD A,#-29
3816 ;ADD A,#-31
3817GET_TRANS_CHAR_:
3818 MOV DPTR,#TRANSLATE_DB
3819 MOVC A,@A+DPTR
3820RET
3821;)FI
3822;*******************************************************************************
3823;*******************************************************************************
3824;** POMOCNE FUNKCE
3825;*******************************************************************************
3826;*******************************************************************************
3827
3828;*******************************************************************************
3829;* ZJISTI, KOLIK PIXELU Z PRAVA A Z LEVA ZACINA ZNAK
3830;* VSTUPY: A .... HODNOTA ZNAKU
3831;* VYSTUPY: R4 .... POCET PIXELU Z PRAVA
3832;* R3 .... POCET PIXELI Z LEVA
3833;* Cy .... 0 - OK / 1 - ERR
3834;* MENI:
3835;* STACK:
3836;*******************************************************************************
3837%RESLOCAL
3838GET_DUMMYPIX:
3839 PUSH DPL
3840 PUSH DPH
3841
3842 MOV DPH,#0F1H
3843 MOV DPL,A
3844
3845 CALL FLASH_BYTERD
3846 MOV B,A
3847 ANL B,#0Fh
3848 MOV R4,B
3849 SWAP A
3850 ANL A,#0Fh
3851 MOV R3,A
3852
3853 POP DPH
3854 POP DPL
3855RET
3856;*******************************************************************************
3857;* ZJISTI, KOLIK PIXELU Z PRAVA A Z LEVA ZACINA ZNAK
3858;* VSTUPY: DPTR,R2 .... ADRESA
3859;* R5 .... ROZLISENI X
3860;* R6 .... ROZLISENI Y
3861;* VYSTUPY: R4 .... POCET PIXELU Z PRAVA
3862;* R3 .... POCET PIXELI Z LEVA
3863;* Cy .... 0 - OK / 1 - ERR
3864;* MENI:
3865;* STACK:
3866;*******************************************************************************
3867%RESLOCAL
3868GET_CHAR_DUMMYPIX:
3869 ; NEJDRIV TESTUJ Z LEVA
3870 MOV R6,#0 ; POCITADLO SLOUPCU
3871 %L(CYKL00):
3872 MOV R7,#3 ; POCITADLO RADKU
3873 %L(CYKL0):
3874 CALL GET_BYTE
3875 JC %L(END0)
3876 DJNZ R7,%L(CYKL0)
3877
3878 INC R6
3879 ; ZJISTI, JESTLI UZ JSI NEPREKROCIL ROZSAH ROZLISENI BITMAPY
3880 MOV A,R6
3881 %CMP(A,#16)
3882 JC %L(CYKL00)
3883 ; UZ JSI PREKROCIL - OKAMZITE SKONCI S CHYBOU
3884 SETB C
3885 MOV R3,#0FFh
3886 MOV R4,#0FFh
3887 SJMP %L(END)
3888 %L(END0):
3889 MOV A,R6
3890 MOV R3,A ; ULOZ NA VYSTUP
3891 %CMP(R3,#1)
3892 JC %L(END0_)
3893 DEC R3
3894
3895 %CMP(R3,#1)
3896 JC %L(END0_)
3897 DEC R3
3898
3899 ;CMP(R3,#1)
3900 ;JC %L(END0_)
3901 ;DEC R3
3902
3903 ; MAS POCET RADKU Z LEVA, PO KTERYCH TEPRVE ZACINA NEJAKY SYMBOL
3904 ; ZJISTI TO STEJNE, ALE Z PRAVA
3905 %L(END0_):
3906 MOV R6,#15 ; POCITADLO SLOUPCU
3907 %L(CYKL01):
3908 MOV R7,#3 ; POCITADLO RADKU
3909 %L(CYKL1):
3910 CALL GET_BYTE
3911 JC %L(END1)
3912 DJNZ R7,%L(CYKL1)
3913
3914 DEC R6
3915 ; ZJISTI, JESTLI UZ JSI NEPREKROCIL ROZSAH ROZLISENI BITMAPY
3916 MOV A,R6
3917 JNZ %L(CYKL01)
3918 ; UZ JSI PREKROCIL - OKAMZITE SKONCI S CHYBOU
3919 SETB C
3920 SJMP %L(END)
3921 %L(END1):
3922 ; ULOZ VYSLEDEK NA VYSTUP
3923 MOV A,#16
3924 CLR C
3925 SUBB A,R6
3926 MOV R4,A
3927 CLR C
3928 DEC R4
3929
3930 %CMP(R4,#1)
3931 JC %L(END)
3932 DEC R4
3933 %L(END):
3934RET
3935
3936%RESLOCAL
3937GET_BYTE:
3938 PUSH DPL
3939 PUSH DPH
3940
3941 MOV A,R7
3942 DEC A
3943 MOV B,#16
3944 MUL AB
3945 ADD A,R6
3946 XCH A,B
3947 ADDC A,#0
3948 XCH A,B
3949
3950 CLR C
3951 ADD A,DPL
3952 MOV DPL,A
3953
3954 MOV A,B
3955 ADDC A,DPH
3956 MOV DPH,A
3957
3958 CALL FLASH_BYTERD
3959 ADD A,#-1 ; POKUD JE V Acc NEJAKA HODNOTA, NASTAV Cy
3960
3961 POP DPH
3962 POP DPL
3963RET
3964
3965
3966%RESLOCAL
3967ARR_DN EQU 000h
3968ARR_UP EQU 001h
3969ARR_UD EQU 002h
3970NO_ARR EQU 003h;0FFh
3971;*******************************************************************************
3972;* FUNKCE ZOBRAZUJE BITMAPU SIPEK
3973;* VSTUP: - Acc .... SIPKY
3974;* VYSTUP: -
3975;* NICI: Acc,Cy,B,R0
3976;*******************************************************************************
3977SHOW_ARROW:
3978 ADD A,#1
3979 JZ %L(CLR_)
3980 DEC A
3981 MOV DPTR,#P05 ; NACTI ADRESY PARAMETRU, ZE KTEREHO UDES CIST TEXT
3982 MOV R0,A ; NACTI SIPKU
3983 CALL ParGetParm
3984 MOV B,R0
3985 %CMP(A,B) ; MAS NASTAVENOU NEJAKOU BITMAPU?
3986 ;JNB TEMPBIT2,%L(END) ; POKUD NEMAS OPRAVDU NASTAVENOU ZADNOU SIPKU, TAK DALSI KROKY PRESKAKUJ
3987 JNC %L(CLR_)
3988
3989 MOV DPL,#0 ; LO_BYTE = 0
3990 ADD A,ACC ; HI_BYTE = ADRESA * 2 KVULI POSUNU O 512 BAJTU
3991 MOV DPH,A ; ADRESA BITMAPY KOMPLETNI
3992
3993 MOV A,R3
3994 MOV R2,A ; ZADEJ STRANKU
3995
3996 MOV R5,#64
3997 MOV R4,#64 ; NASTAV ROZLISENI
3998
3999 SETB TEMPBIT2
4000 JB ROTATEDISP,%L(ROT0)
4001 MOV R7,#0
4002 MOV R6,#0
4003 CALL SHOWBMPWND2
4004 SJMP %L(END)
4005 %L(ROT0):
4006 MOV R7,#0
4007 MOV R6,#127
4008 CALL SHOWBMPWND2ROT
4009 SJMP %L(END)
4010 %L(CLR_):
4011 JB ROTATEDISP,%L(ROT1)
4012 SETB CS1
4013 CLR CS2
4014 SJMP %L(CLR__)
4015 %L(ROT1):
4016 SETB CS2
4017 CLR CS1
4018 %L(CLR__):
4019 CALL CLR_LCD_ ; SMAZ PRAVOU POLOVINU - TAM BUDES VYKRESLOVAT BITMAPY
4020 CLR TEMPBIT2
4021 %L(END):
4022 MOV A,POS
4023 SETB ACC.bitPosRefr
4024 MOV POS,A
4025RET
4026
4027%RESLOCAL
4028;*******************************************************************************
4029;* ZOBRAZI NA VYSTUP ZADANOU POLOHU
4030;* VSTUP : A = DEKADICKE CISLO(POLOHA)
4031;* B = STARTOVNI POZICE X (NEBO Y) - DLE TYPU ZOBRAZENI
4032;* MENI : A, B, C
4033;* STACK : 0
4034;*******************************************************************************
4035POSITION EQU TEMP2
4036ROT EQU TEMP
4037
4038LEFT EQU 0
4039RIGHT EQU 1
4040CENTER EQU 2
4041
4042SHOWY0:
4043 ; ZJISTI,JESTLI MAS ROTOVANE ZOBRAZENI
4044 JB ROTATEDISP,%L(R2)
4045
4046 MOV R6,#32
4047 JNB B.0,%L(1)
4048 MOV R6,#64
4049 %L(1):
4050 JNB B.1,%L(_1)
4051 MOV R6,#48
4052 %L(_1):
4053 JNB TEMPBIT2,%L(02)
4054
4055 MOV R6,#64
4056 JNB B.0,%L(01)
4057 MOV R6,#96
4058 SJMP %L(02)
4059 %L(01):
4060 JNB B.1,%L(02)
4061 MOV R6,#80
4062 %L(02):
4063
4064 MOV R7,POSITION
4065 CALL SHOWBMPWND2
4066
4067 RET
4068
4069 %L(R2):
4070 SETB DENNY_CS1
4071 CLR DENNY_CS2
4072
4073 JB TEMPBIT2,%L(011)
4074 SETB DENNY_CS1
4075 SETB DENNY_CS2
4076
4077 %L(011):
4078
4079 MOV R7,#0
4080 JNB B.0,%L(11)
4081 MOV R7,#32
4082 SJMP %L(12)
4083 %L(11):
4084 JNB B.1,%L(12)
4085 MOV R7,#16
4086 %L(12):
4087
4088 MOV R6,POSITION
4089 JB TEMPBIT2,%L(13)
4090 MOV A,R6
4091 ADD A,#32
4092 MOV R6,A
4093 %L(13):
4094 CLR C
4095 CALL SHOWBMPWND2ROT
4096 RET
4097
4098%IF(%NO_COMPILE EQ 0)THEN
4099(
4100DEL_LINES:
4101 PUSH ACC
4102 MOV R4,#64
4103 MOV R5,#8
4104 MOV DPTR,#(' '-32) SHL 8
4105 MOV R2,#0
4106
4107 ; === UPLNE NA PICU!!!!
4108 JB ROTATEDISP,%L(_90ST)
4109 MOV R6,#64
4110 JB TEMPBIT,%L(001)
4111 ; === ROLUJU SE ZNAKEM SMEREM DOLU
4112 MOV A,POSITION;R7
4113 ADD A,#-8
4114 MOV R7,A
4115 CALL SHOWBMPWND2
4116 SJMP %L(_END_)
4117
4118 %L(001):
4119 MOV A,POSITION;R7
4120 ADD A,#72
4121 MOV R7,A
4122 MOV DPTR,#(' '-32) SHL 8
4123 MOV R2,#0
4124 ; === ROLUJU SE ZNAKEM SMEREM NAHORU
4125 CALL SHOWBMPWND2
4126 SJMP %L(_END_)
4127
4128 ; === OTOCENY DISPLEJ
4129 %L(_90ST):
4130 MOV R7,#0
4131 JB TEMPBIT,%L(002)
4132 ; === ROLUJU SE ZNAKEM SMEREM DOLU
4133 MOV A,POSITION;R7
4134 ADD A,#8
4135 MOV R6,A
4136 CLR C
4137 CALL SHOWBMPWND2ROT
4138 SJMP %L(_END_)
4139
4140 %L(002):
4141 MOV A,POSITION;R7
4142 ADD A,#-64
4143 MOV R6,A
4144 ; === ROLUJU SE ZNAKEM SMEREM NAHORU
4145 CLR C
4146 CALL SHOWBMPWND2ROT
4147
4148 SETB DENNY_CS1
4149 CLR DENNY_CS2
4150%L(_END_):
4151 POP ACC
4152RET
4153)FI
4154;* VSTUP :
4155;* B .... POCATECNI POLOHA NA DISPLEJI - ZALEZI NA NATOCENI!
4156
4157SHOW_POSITION:
4158 MOV POSITION,B
4159 ANL A,#1Fh
4160 CALL DEL_LINES ; VYMAZ RADKY PRED A ZA BITMAPOU KVULI STOPAM, KTERE ZUSTAVALY
4161 MOV R7,A
4162 ADD A,ACC ; VYNASOB 2x - KVULI DVOUZNAKU
4163 MOV R0,A ; ULOZ OFFSET - POLOHU DO R0
4164
4165 PUSH ACC ; ULOZ OFFSET PRO DALSI ZPRACOVANI
4166
4167 MOV DPTR,#P03 ; ULOZ DO DPTR DANY PARAMETR
4168 CALL ParGetParm ; NACTI PARAMETR - V Acc BUDES MIT CISLO, KTERE UDAVA
4169 ; OFFSET NA STRANCE VE FLASH
4170 MOV B,R3
4171 MOV R2,B ; ULOZ DO R2 ADRESU STRANKY VE FLASHCE, KDE SE NACHAZEJI PRISLUSNE BITMAPY
4172
4173 MOV B,R0
4174 %LCJNE(A,B,%L(_NXT0)); ZJISTI, JESTLI MAS NASTAVENE DEFAULTNI ZOBRAZENI
4175 ; POKUD DEFAULT, NEZOBRAZUJ NIC - MEZERU
4176 POP ACC
4177 JMP %L(END)
4178
4179%IF(%NO_COMPILE EQ 1)THEN
4180(
4181 %LCJNE(A,B,%L(_NXT0)); ZJISTI, JESTLI MAS NASTAVENE DEFAULTNI ZOBRAZENI
4182 ; DEFAULTNI ZOBRAZENI
4183 POP ACC ; VYTAHNI STACK
4184 MOV A,R7 ; ZJISTI, JAKOU MAS POLOHU
4185 JZ %L(_NEPOS) ; KDYZ POLOHA=0, TAK ZOBRAZUJ NEZNAME PATRO
4186 DEC A
4187 ;;;;;;;;;;;;;;;;
4188 CALL A2BCD
4189 ;;;;;;;;;;;;;;;;
4190 PUSH ACC
4191 ANL A,#0F0h
4192 JNZ %L(DESITKY)
4193 ; ZOBRAZUJ POUZE STANICE POD 10
4194 POP ACC
4195 MOV B,#1;'0'-32
4196 ADD A,B
4197 CLR C
4198 MOV DPH,A
4199 MOV DPL,#0
4200 MOV R2,#0
4201 MOV R4,#32;* R4 ... RESOLUTION_X
4202 MOV R5,#64;* R5 ... RESOLUTION_Y
4203
4204 MOV B,#CENTER
4205 CALL SHOWY0
4206 JMP %L(END)
4207
4208 %L(DESITKY):
4209 ; ZOBRAZUJES STANICE I NAD 10
4210 POP ACC
4211
4212 PUSH ACC
4213 ANL A,#0Fh
4214 MOV B,#1;'0'-32
4215 ADD A,B
4216 MOV DPH,A
4217 MOV DPL,#0
4218 MOV R4,#32;* R4 ... RESOLUTION_X
4219 MOV R5,#64;* R5 ... RESOLUTION_Y
4220 MOV R2,#0
4221
4222 MOV B,#RIGHT
4223 CALL SHOWY0
4224
4225 POP ACC
4226 SWAP A
4227 ANL A,#0Fh
4228 MOV B,#1;'0'-32
4229 ADD A,B
4230 MOV DPH,A
4231 MOV DPL,#0
4232 MOV R4,#32;* R4 ... RESOLUTION_X
4233 MOV R5,#64;* R5 ... RESOLUTION_Y
4234 MOV R2,#0
4235
4236 MOV B,#LEFT
4237 CALL SHOWY0
4238 SJMP %L(END)
4239
4240 %L(_NEPOS):
4241 ; DEFAULTNI ZOBRAZENI NEZNAMEHO PATRA
4242 MOV DPH,#12;'?'-32
4243 ;PUSH DPH
4244 MOV DPL,#0
4245 MOV R2,#0
4246 MOV R4,#32;* R4 ... RESOLUTION_X
4247 MOV R5,#64;* R5 ... RESOLUTION_Y
4248 MOV B,#CENTER
4249 CALL SHOWY0
4250 SJMP %L(END)
4251)FI
4252
4253%L(_NXT0):
4254 MOV R7,A ; ULOZ BITMAPU
4255 POP ACC ; VYTAHNI ZE STACKU OFFSET PRVNIHO ZNAKU ZE DVOU NEBO BITMAPU
4256 MOV R0,A
4257
4258 MOV A,R7 ; BUDES ZOBRAZOVAT POUZE JEDEN ZNAK - NEBO JEDNU BITMAPU
4259 %CMP(A,#128)
4260 JNC %L(SPEC_BMP)
4261
4262 INC R0 ; POSUN SE NA DRUHY ZNAK
4263 MOV DPTR,#P03 ; ULOZ DO DPTR DANY PARAMETR
4264 CALL ParGetParm ; NACTI PARAMETR - V Acc BUDES MIT CISLO, KTERE UDAVA
4265 ; OFFSET NA STRANCE VE FLASH
4266 MOV B,R0
4267 CJNE A,B,%L(2ZN)
4268
4269
4270 MOV DPL,#0
4271 MOV DPH,R7 ; NACTI ULOZENY OFFSET PRVNI BITMAPY
4272 MOV R4,#32;* R4 ... RESOLUTION_X
4273 MOV R5,#64;* R5 ... RESOLUTION_Y
4274 MOV R2,#0
4275
4276 MOV B,#CENTER
4277 CALL SHOWY0
4278 JMP %L(END)
4279
4280 %L(SPEC_BMP):
4281 ADD A,#-128 ; ODECTI 128
4282 ADD A,ACC ; VYNASOB 2X
4283 ADD A,#128 ; PRICTI 128 KVULI OFFSETU
4284 %L(SPEC_BMP_):
4285 MOV DPL,#0
4286 MOV DPH,A ; NACTI ULOZENY OFFSET PRVNI BITMAPY
4287 MOV R2,#0
4288 MOV R4,#64;* R4 ... RESOLUTION_X
4289 MOV R5,#64;* R5 ... RESOLUTION_Y
4290
4291 MOV B,#LEFT
4292 CALL SHOWY0
4293 JMP %L(END)
4294
4295 %L(2ZN): ; BUDES ZOBRAZOVAT DVA ZNAKY
4296
4297 PUSH ACC
4298
4299 MOV A,R7 ; ULOZ PRVNI BITMAPU
4300 MOV DPL,#0
4301 MOV DPH,A
4302
4303 MOV R4,#32;* R4 ... RESOLUTION_X
4304 MOV R5,#64;* R5 ... RESOLUTION_Y
4305 MOV R2,#0
4306 MOV B,#LEFT
4307 CALL SHOWY0
4308
4309 MOV DPL,#0
4310 POP DPH
4311 MOV R2,#0
4312 MOV R4,#32;* R4 ... RESOLUTION_X
4313 MOV R5,#64;* R5 ... RESOLUTION_Y
4314 MOV B,#RIGHT
4315 CALL SHOWY0
4316%L(END):
4317
4318RET
4319
4320;*******************************************************************************
4321;* FUNKCE PREVADI CISLO V HEXA DO DEC
4322;* VSTUP: Acc ... HEXA CISLO
4323;* VYSTUP: Acc ... DESITKY
4324;* B ... JEDNOTKY
4325;* R0 ... STOVKY
4326;* NICI: Acc, Cy, B, R0, R1
4327;*******************************************************************************
4328A2DEC:
4329 MOV B,#100
4330 DIV AB
4331 MOV R0,A ; ULOZ STOVKY
4332 MOV A,B
4333 MOV B,#10
4334 DIV AB
4335RET
4336
4337%RESLOCAL
4338;*******************************************************************************
4339;* HODNOTU V A (-99..99) PREVED DO BCD
4340;* VSTUP : A = DEKADICKE CISLO
4341;* VYSTUP: A = BCD CISLO
4342;* C = ZNAMENKO (1 = ZAPORNE CISLO)
4343;* MENI : A, B, C
4344;* STACK : 0
4345;*******************************************************************************
4346A2BCD:
4347 MOV B,#10
4348 JB ACC.7,%L(M)
4349 DIV AB
4350 SWAP A
4351 ADD A,B
4352 CLR C
4353 RET
4354
4355 ; TADY ZPRACUJ ZAPORNA CISLA
4356 %L(M):
4357 CPL A
4358 INC A
4359 DIV AB
4360 SWAP A
4361 ADD A,B
4362 SETB C
4363 RET
4364
4365;*******************************************************************************
4366;* FUNKCE OTESTUJE OBSAH ZADANEHO BITMAP/TEXT PARAMETRU, ZDA NECO OBSAHUJE
4367;* VSTUP: DPTR ... ADRESA PARAMETRU
4368;* VYSTUP: F0 ... 0 - ZADNA BITMAPA/ 1 - JE BITMAPA
4369;* Cy ... 0 - ZADNY TEXT/ 1 - JE TEXT
4370;* NICI: Acc, Cy, B, R0, R1
4371;*******************************************************************************
4372TEST_PARM:
4373 ; ULOZ ADRESU PARAMETRU
4374 PUSH DPH
4375 PUSH DPL
4376
4377 ; ZJISTI NEJDRIV, JESTLI MAS NEJAKY TEXT
4378 MOV R0,#3
4379 CALL ParGetParm
4380 ; VRAT ZALOHU
4381 POP DPL
4382 POP DPH
4383
4384 PUSH ACC ; ULOZ 1. VRACENY ZNAK ZOBRAZOVANEHO TEXTU
4385
4386 MOV R0,#0
4387 CALL ParGetParm
4388
4389 MOV B,R0
4390 %CMP(A,B)
4391 MOV F0,C ; ULOZ PRIZNAK BITMAPY
4392
4393 POP ACC ; VYTAHNI ZE ZALOHY 1. ZNAK A OTESTUJ, ZDA NEJDE O "ENTER"
4394 %CMP(A,B)
4395RET
4396;*******************************************************************************
4397;* FUNKCE VRACI HODNOTU PARAMETRU DLE RELATIVNIHO UKAZATELE
4398;* VSTUP: Acc ... RELATIVNI CISLO PARAMETRU V TABULCE
4399;* R0 ... POSUN V PARAMETRU
4400;* VYSTUP: Acc ... HODNOTA PARAMETRU
4401;* R2 ... MAX. HODNOTA
4402;* R1 ... MIN. HODNOTA
4403;* NICI: Acc, Cy, B, R0, R1, DPTR, ..
4404;*******************************************************************************
4405GET_PARM_VAL_RAW:
4406 CALL GET_PARM_ADDR
4407 CALL ParGetParmRaw
4408 SJMP %L(END)
4409
4410GET_PARM_VAL:
4411 CALL GET_PARM_ADDR
4412 CALL ParGetParm
4413
4414%L(END):
4415 MOV B,R0
4416 MOV R2,B
4417RET
4418
4419GET_PARM_ADDR:
4420 PUSH AR0 ; ZALOHUJ R0
4421 CALL GETMENU00 ; V DPTR VRACI POINTER NA POPIS PARAMETRU
4422 MOV DPL,R2
4423 MOV DPH,R1
4424 POP AR0 ; VRAT OFFSET
4425RET
4426;*******************************************************************************
4427;* FUNKCE VRACI CISLO PARAMETRU A POINTER NA TEXT S POPISEM PARAMETRU
4428;* VSTUP: Acc ... RELATIVNI CISLO PARAMETRU V TABULCE
4429;* VYSTUP: Acc ... ABSOLUTNI CISLO PARAMETRU
4430;* B ..... TYP PARAMETRU
4431;* DPTR ... POINTER NA TEXT S POPISEM PARAMETRU
4432;* R2 ... LO_ADDR POINTER NA PARAMETR
4433;* R1 ... HI_BYTE POINTER NA PARAMETR
4434;* R3 ... LO_BYTE ADRESY MENUTAB
4435;* R4 ... HI_BYTE ADRESY MENUTAB
4436;* NICI: Acc, Cy, ..
4437;*******************************************************************************
4438
4439%RESLOCAL
4440GETMENU00:
4441 MOV R1,A
4442 MOV R2,#0
4443 MOV DPTR,#MENUCODE
4444 %L(CYKL):
4445 CLR A
4446 MOVC A,@A+DPTR
4447 ;MOV B,A
4448 ;ANL A,#MENUTYPE_MASK ; MASKUJ PREFIX PARAMETRU
4449 ;ANL B,#NOT MENUTYPE_MASK
4450 XCH A,R2
4451 MOV B,R1
4452 CLR F0
4453 CJNE A,B,%L(TST)
4454 ; JE TO TENTO PARAMETR
4455 SETB F0
4456 %L(TST):
4457 XCH A,R2
4458 MOV B,A
4459 ANL A,#MENUTYPE_MASK ; MASKUJ PREFIX PARAMETRU
4460 ANL B,#NOT MENUTYPE_MASK
4461
4462 JNB F0,%L(ADD)
4463
4464 PUSH ACC ; ULOZ TYP PARAMETRU
4465 MOV R3,DPL ; ULOZ ADRESU NA PARAMETR V TABULCE MENUTAB
4466 MOV R4,DPH
4467
4468 INC DPTR
4469 CLR A
4470 MOVC A,@A+DPTR
4471
4472 PUSH ACC
4473 INC DPTR
4474 CLR A
4475 MOVC A,@A+DPTR
4476 MOV R1,A ; NACTI HIADDR POINTERU NA PARAMETR
4477
4478 INC DPTR
4479 CLR A
4480 MOVC A,@A+DPTR
4481 MOV R2,A ; NACTI LOADDR POINTERU NA PARAMETR
4482
4483 INC DPTR
4484 CLR A
4485 MOVC A,@A+DPTR
4486 XCH A,R0
4487
4488 INC DPTR
4489 CLR A
4490 MOVC A,@A+DPTR
4491
4492 MOV DPL,A ; ZKOMPLETUJ ADRESU TEXTU
4493 MOV DPH,R0
4494
4495 POP ACC ; VRAT ZKUTECNE CISLO PARAMETRU
4496
4497 POP B
4498 RET
4499
4500RET
4501
4502 %L(ADD):
4503 MOV A,DPL
4504 ADD A,B
4505 MOV DPL,A
4506 CLR A
4507 ADDC A,DPH
4508 MOV DPH,A
4509
4510 INC R2
4511 SJMP %L(CYKL)
4512
4513;*******************************************************************************
4514;*
4515;* R6 .... POCET DIGITU
4516;*
4517;*******************************************************************************
4518%RESLOCAL
4519_PRINT_INT:
4520 CALL A2DEC
4521
4522 CJNE R6,#0,%L(01)
4523 SJMP %L(END)
4524%L(01):
4525 CJNE R6,#1,%L(02)
4526 MOV A,B
4527 ADD A,#'0'
4528 MOV R0,A
4529 CALL _PUTCHAR
4530 SJMP %L(END)
4531%L(02):
4532 CJNE R6,#2,%L(03)
4533 XCH A,B
4534 PUSH ACC ; ZALOHA JEDNOTKY
4535
4536 XCH A,B
4537 ADD A,#'0'
4538 MOV R0,A
4539 CALL _PUTCHAR
4540
4541 POP ACC
4542 ADD A,#'0'
4543 MOV R0,A
4544 CALL _PUTCHAR
4545 SJMP %L(END)
4546
4547%L(03):
4548 CJNE R6,#3,%L(END)
4549
4550 XCH A,B
4551 PUSH ACC ; ZALOHA JEDNOTKY
4552 XCH A,B
4553 PUSH ACC ; ZALOHA DESITKY
4554
4555 MOV A,R0
4556 ADD A,#'0' ; VYPIS STOVKY
4557 MOV R0,A
4558 CALL _PUTCHAR
4559
4560 POP ACC
4561 ADD A,#'0'
4562 MOV R0,A ; VYPIS DESITKY
4563 CALL _PUTCHAR
4564
4565 POP ACC
4566 ADD A,#'0'
4567 MOV R0,A ; VYPIS JEDNOTKY
4568 CALL _PUTCHAR
4569%L(END):
4570RET
4571
4572STD_PARM:
4573DB 124+32,' P00 ',125+32,0 ; DELKA 42 BODU
4574
4575;********************************************************************
4576; VRACI BITOVOU HODNOTU PARAMETRU
4577; VSTUP: DPTR .... ADRESA PARAMETRU
4578; VYSTUP: CY ..... HODNOTA PARAMETRU
4579;********************************************************************
4580GET_BIT_PARM:
4581 MOV R0,#0
4582 CALL ParGetParm
4583 MOV C,ACC.0
4584RET
4585
4586END
Note: See TracBrowser for help on using the repository browser.