📄 main.lst
字号:
275 000000 include vec.asm ; System Vector
276 000000 ;**********************************
277 000000 ; Main routine Vector *
278 000000 ;**********************************
279 000000 0000 nop ; 0
280 000001 0000 nop ; 1 you can delete this struction
281 000002 800A jmp @@int_main ; 2 you can delete this struction
282 000003 ; jmp @@int_main ; 3 you can delete this struction
283 000003 ; JMP @@int_main ; 4 ; reserved for user!
284 000003 ; JMP @@int_main ; 5 ; |
285 000003 ; JMP @@int_main ; 6 ; |
286 000003 ; JMP @@int_main ; 7 ; reserved for user!
287 000003 ;**********************************
288 000003 ; Interrupt Vector *
289 000003 ;**********************************
290 000008 org 08h
291 000008 8039 jmp @@int_rs ; 8 Interrupt Service Routine
292 000009
293 000009 800A jmp @@int_main ; 9 you can delete this struction
294 00000A
295 00000A ;Program Begin
296 00000A org 0ah
297 00000A include pro.asm ; Main Routine
298 00000A ;**********************************
299 00000A ; Initialize *
300 00000A ;**********************************
301 00000A @@int_main:
302 00000A 2D0F mov a,#00001111b
303 00000B 2FDF b0mov stkp,a ; Disable interrupt and Stack
304 00000C 3600 b0mov pflag,#0 ; clear C,DW,Z flag
305 00000D ; b0mov rbank,#0 ; Ram bank0 operate
306 00000D
307 00000D C01A call @@clr_ram ; clear ram
308 00000E C021 call @@initcpu ; initial cpu register
309 00000F C030 call @@init_int ; initial Interrupt
310 000010
311 000010 6FDF b0bset fgie ; Enable Global Interrupt
312 000011 ;**********************************
313 000011 ; System initial *
314 000011 ;**********************************
315 000011 @@premain:
316 000011 C058 call @@INTface_init
317 000012 C0D4 call @@key_init
318 000013 C075 call const_set
319 000014 ;**********************************
320 000014 ; Main program *
321 000014 ;**********************************
322 000014 @@main:
323 000014 6ECA b0bset fwdrst ; clear WatchDog timer, or clear in interrupt routine!
324 000015 C05C call @@Intface
325 000016 C0DC call @@mnkey
326 000017 C122 call @@Keyappl
327 000018 C079 call RF_remote_init
328 000019 ; call
329 000019 ; call
330 000019 8014 jmp @@main
331 00001A include com.asm ; Common Ram/Pin/Register preset
332 00001A ;Clear Ram
333 00001A @@clr_ram:
334 00001A 3400 b0mov y,#0 ; clear bank0
335 00001B 3330 b0mov z,@Rambank0_val
336 00001C 2BE7 @@: clr @yz
337 00001D 2683 decms z
338 00001E 801C jmp @b
339 00001F 2BE7 clr @yz
340 000020 0E00 ret
341 000021 ;================================================
342 000021 ;Initial CPU Register and I/O Direction
343 000021 @@initcpu:
344 000021 ; b0mov r,#0x00 ; If use these registers, you add delete them
345 000021 ; b0mov z,#0x00 ; |
346 000021 ; b0mov y,#0x00 ; |
347 000021 ; |
348 000021 ; b0mov x,#0x00 ; |
349 000021 ; b0mov l,#0x00 ; |
350 000021 ; b0mov h,#0x00 ; If use these registers, you add delete them
351 000021 ;************************************************************
352 000021 ;I/O port(Pur register Set/Port Value Set/IO direction Set) *
353 000021 ;************************************************************
354 000021 @SET_PUR @Pur_set
355 000021 2D05 mov a, #@Pur_set
356 000022 2FBE DC 0x2FBE ; B0MOV PUR, A
357 000023 ;...............
358 000023 mov_ p1,@p1set
359 000023 2D00 mov a, @p1set
360 000024 1FD1 mov p1, a
361 000025 mov_ p1m,@p1Mset
362 000025 2D01 mov a, @p1Mset
363 000026 1FC1 mov p1m, a
364 000027 mov_ p1w,@p1Wset
365 000027 2D00 mov a, @p1Wset
366 000028 1FC0 mov p1w, a
367 000029 mov_ p2,@p2set
368 000029 2DFF mov a, @p2set
369 00002A 1FD2 mov p2, a
370 00002B mov_ p2m,@p2Mset
371 00002B 2D00 mov a, @p2Mset
372 00002C 1FC2 mov p2m, a
373 00002D ;================================================
374 00002D ;Other settings!
375 00002D ;oscm
376 00002D mov_ oscm,@Oscm_set
377 00002D 2D40 mov a, @Oscm_set
378 00002E 1FCA mov oscm, a
379 00002F /*
380 00002F IF @ADappl_set == 1
381 00002F ;A/D transform
382 00002F clr adm
383 00002F ENDIF
384 00002F IF @DAappl_set == 1
385 00002F ;D/A transform
386 00002F clr dam
387 00002F ENDIF
388 00002F IF @Lcdappl_set == 1
389 00002F ;LCD display
390 00002F clr lcdm
391 00002F ENDIF
392 00002F */
393 00002F ;Pedge setting
394 00002F 0E00 ret
395 000030 ;========================================================
396 000030
397 000030
398 000030 include int.asm ; Interrupt
399 000030 ;**************************************
400 000030 ; Initial Interrupt *
401 000030 ;**************************************
402 000030 @@init_int:
403 000030 2BC9 clr inten
404 000031 2BC8 clr intrq
405 000032 ; Timer/Event0 (TC0)
406 000032 ; b0bclr ftc0enb ; To disable Tc0 timer/event
407 000032 2D70 mov A,@SysTc0m ; Set tC0 RATE=XXX
408 000033 2FDA b0mov TC0M,A ; To set Tc0 clock=fcpu/xx
409 000034 2D06 mov A,@SysTc0c ; SET INITIAL tC0 BASETIME= XXMS
410 000035 2FDB b0mov TC0C,A
411 000036 6DC9 b0bset ftc0ien ; To enable Tc0 interrupt service
412 000037 6FDA b0bset ftc0enb ; To enable Tc0 timer
413 000038 0E00 ret
414 000039 ;************************************************
415 000039 ; Interrupt Service Routine *
416 000039 ;************************************************
417 000039 @@int_rs:
418 000039 0210 b0xch a,accbuf ; save a
419 00003A 2E86 b0mov a,pflag ; save pflag
420 00003B 2F11 b0mov pflagbuf,a
421 00003C ; PUSH
422 00003C ; b0mov a,y ; if you use y,z,r,x,h,l in interrupt routine,please add these structions!
423 00003C ; b0mov ybuf,a ; |
424 00003C ; b0mov a,z ; |
425 00003C ; b0mov zbuf,a ; |
426 00003C ; b0mov a,r ; |
427 00003C ; b0mov rbuf,a ; |
428 00003C ; b0mov a,x ; |
429 00003C ; b0mov xbuf,a ; |
430 00003C ; B0MOV a,h ; |
431 00003C ; B0MOV hbuf,a ; |
432 00003C ; B0MOV a,l ; |
433 00003C ; B0MOV lbuf,a ; if you use y,z,r,x,h,l in interrupt routine,please add these structions!
434 00003C ;*******************************
435 00003C ;auto check proper interrupt *
436 00003C ;*******************************
437 00003C ; Is Timer 0 Interrupt
438 00003C 7DC9 b0bts1 ftc0ien
439 00003D 8040 jmp @f
440 00003E 75C8 b0bts0 ftc0irq
441 00003F 804A jmp @@Int_Tc0
442 000040 @@:
443 000040
444 000040 ; End interrupt!
445 000040 @@Int_rs90:
446 000040 notb p1.3
447 000040 7BD1 b0bts1 p1.3
448 000041 8044 jmp $+3
449 000042 63D1 b0bclr p1.3
450 000043 8045 jmp $+2
451 000044 6BD1 b0bset p1.3
452 000045 4BC1 bset p1m.3
453 000046 2E11 b0mov a,pflagbuf
454 000047 2F86 b0mov pflag,a
455 000048 ; POP
456 000048 ; b0mov a,ybuf ; if you use y,z,r,x,h,l in interrupt routine,please add these structions!
457 000048 ; b0mov y,a ; |
458 000048 ; b0mov a,zbuf ; |
459 000048 ; b0mov z,a ; |
460 000048 ; b0mov a,rbuf ; |
461 000048 ; b0mov r,a ; |
462 000048 ; B0MOV a,xbuf ; |
463 000048 ; B0MOV x,a ; |
464 000048 ; B0MOV a,hbuf ; |
465 000048 ; B0MOV h,a ; |
466 000048 ; B0MOV a,lbuf ; |
467 000048 ; B0MOV l,a ; if you use y,z,r,x,h,l in interrupt routine,please add these structions!
468 000048 0210 b0xch a,accbuf
469 000049 0F00 reti
470 00004A ;**********************************************
471 00004A ; Exterior interrupt service *
472 00004A ;**********************************************
473 00004A ;----------------------------------
474 00004A ;----------------------------------
475 00004A ;----------------------------------
476 00004A ;----------------------------------
477 00004A ;Timer/Event0 xmS
478 00004A @@int_tc0:
479 00004A ; b0bclr ftc0ien ; To disable Tc0 interrupt service
480 00004A ; b0bclr ftc0enb ; To disable Tc0 timer
481 00004A 2D70 mov a,@SysTc0m ;
482 00004B 2FDA b0mov tc0m,a ; To set Tc0 clock = fcpu /xx
483 00004C 2D06 mov a,@SysTc0c ;
484 00004D 2FDB b0mov tc0c,a ;
485 00004E ;service for interrupt!
486 00004E
487 00004E 8087 jmp RF_remote_process
488 00004F RF_remote_process_ret:
489 00004F ;call RF_remote_process
490 00004F 2612 decms intwk00
491 000050 8054 jmp @f
492 000051 2D14 mov a,#20
493 000052 1F12 mov intwk00,a
494 000053 6813 b0bset @Sys5msIRQ
495 000054 @@:
496 000054 6DC9 b0bset ftc0ien ; To enable Tc0 interrupt service
497 000055 6FDA b0bset ftc0enb ; To enable Tc0 timer
498 000056 65C8 b0bclr ftc0irq ; To clear Tc0 interrupt request
499 000057 8040 jmp @@Int_rs90
500 000058
501 000058
502 000058
503 000058
504 000058 ;*********************************
505 000058 ; Interrupt Interface *
506 000058 ;*********************************
507 000058 @@INTface_init:
508 000058 2B13 clr @intgnd ;Int interface register
509 000059
510 000059 mov_ @Sys50msC,@Sys50msStep ;set the steps of 50ms INT
511 000059 2D0A mov a, @Sys50msStep
512 00005A 1F14 mov @Sys50msC, a
513 00005B 0E00 ret
514 00005C ;**********************************
515 00005C ; Interrupt Interface Routine *
516 00005C ;**********************************
517 00005C @@IntFace:
518 00005C 2E13 b0mov a,@intgnd
519 00005D jz @@Intface99
520 00005D 7086 b0bts0 FZ
521 00005E 8063 jmp @@Intface99
522 00005F ;check Interface request
523 00005F 7013 b0bts0 @Sys5msIRQ
524 000060 C064 call @@Intface5ms
525 000061
526 000061
527 000061 7113 b0bts0 @Sys50msIRQ
528 000062 C068 call @@Intface50ms
529 000063
530 000063
531 000063
532 000063
533 000063
534 000063
535 000063
536 000063
537 000063
538 000063
539 000063
540 000063
541 000063
542 000063
543 000063
544 000063 @@Intface99:
545 000063 0E00 ret
546 000064
547 000064 ;************************************************
548 000064 ;* Interrupt 5ms Interface *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -