星星灯.asm

来自「单片机开发资料光盘-双龙-686M.zip」· 汇编 代码 · 共 60 行

ASM
60
字号
.include"8515def.inc"

	rjmp	RESET	

.def    temp    =r16
.def	temp1	=r17
.def	udata	=r21
.def	ddata	=r22

.cseg
.org    0x10
RESET:	ldi	temp,high(RAMEND)  
	out	SPH,temp	         
	ldi	temp,low(RAMEND)	 
	out	SPL,temp
      
        ldi     temp,0xff
        out     ddra,temp
        out     ddrc,temp

start:  wdr
        ldi     udata,0x6a
        ldi     ddata,0x3c
startp: out     porta,udata
        out     portc,ddata
        ldi     temp,0x80
        rcall   delay
        rcall   randm
        rjmp    startp  



delay:  push    temp
l1:     push    temp
l2:     dec     temp
        brne    l2               
        pop     temp
        dec     temp
        brne    l1               
        pop     temp
        dec     temp
        brne    delay               
        ret                      


randm:    mov   temp,udata
          mov   temp1,udata
          rol   temp
          eor   temp1,temp
          rol   temp
          rol   temp
          eor   temp1,temp
          mov   temp,ddata
          swap  temp
          eor   temp,temp1
          rol   temp
          rol   ddata
          rol   udata
          ret      	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?