📄 apr9600.asm
字号:
tmr0 equ 01h
z equ 02h
status equ 03h
rp0 equ 5
tmr0b equ 06h
porta equ 05h
portb equ 06h
portc equ 07h
portd equ 08h
DL1 EQU 77H
DL2 EQU 78H
value equ 21h
temp equ 22h
intcon equ 0bh
option_reg equ 81h
trisa equ 85h
trisb equ 86h
trisc equ 87h
trisd equ 88h
adcon1 equ 9fh
org 000h;
main
nop
bsf status,rp0
movlw 06h
movwf adcon1
movlw 00h
movwf option_reg
movlw 00h
movwf trisa
movwf trisc
movwf trisd
movlw 0ffh
movwf trisb
bcf status,rp0
MOVLW b'00111110'
movwf portc
check
movlw b'11101111'
movwf portd
call scan
movlw b'11011111'
movwf portd
call scan
movlw b'10111111'
movwf portd
call scan
movlw b'01111111'
movwf portd
call scan
goto check
;-------------------------
scan
bsf status,rp0
movlw 0fh
movwf trisb
bcf status,rp0
movlw 00h
movwf portb
nop
nop
movf portb,0
andlw 0fh
movwf value
xorlw 0fh
btfsc status,2
return
movfw value
addlw 0f0h
andwf portd,0
movwf value
comf value,0
clrf portc
movwf temp
goto trans
;-----------------------
delay
bcf intcon,2
movlw tmr0b
movwf tmr0
loop1
btfss intcon,2
goto loop1
return
;-------------------------------
trans
movlw b'10001000';1
subwf temp,0
btfsc status,z;
goto mode1
movlw b'10000100';2
subwf temp,0
btfsc status,z
goto mode2
movlw b'10000010';3
subwf temp,0
btfsc status,z
goto reset
movlw b'10000001';4
subwf temp,0
btfsc status,z
return
movlw b'01001000';5
subwf temp,0
btfsc status,z
goto record1
movlw b'01000100';6
subwf temp,0
btfsc status,z
goto stoprecord1
movlw b'01000010';7
subwf temp,0
btfsc status,z
goto play1
movlw b'01000001';8
subwf temp,0
btfsc status,z
goto stopplay1
movlw b'00101000';9
subwf temp,0
btfsc status,z
goto record2
movlw b'00100100';0
subwf temp,0
btfsc status,z
goto stoprecord2
movlw b'00100010';a
subwf temp,0
btfsc status,z
goto play2
movlw b'00100001';b
subwf temp,0
btfsc status,z
goto stopplay2
movlw b'00011000';c
subwf temp,0
btfsc status,z
goto record
movlw b'00010100';d
subwf temp,0
btfsc status,z
goto stoprecord
movlw b'00010010';e
subwf temp,0
btfsc status,z
goto play
movlw b'00010001';f
subwf temp,0
btfsc status,z
goto stopplay
;--------------------------
mode1
movlw b'00111110'
movwf portc
return
mode2
movlw b'00111100'
movwf portc
return
reset
movlw b'11111111'
movwf portc
call delay
call delay
call delay
call delay
clrf portc
return
record1
movlw b'00011010'
movwf portc
return
stoprecord1
movlw b'01011110'
movwf portc
return
play1
movlw b'01111110'
movwf portc
CALL delay10ms
movlw b'00111010'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
call delay10ms
return
stopplay1
movlw b'01111110'
movwf portc
call delay10ms
movlw b'00111010'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
call delay10ms
return
record2
movlw b'01010110'
movwf portc
return
stoprecord2
movlw b'01011110'
movwf portc
return
play2
movlw b'01111110'
movwf portc
call delay10ms
movlw b'01110110'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
call delay10ms
return
stopplay2
movlw b'01111110'
movwf portc
call delay10ms
movlw b'01110110'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
call delay10ms
return
record
movlw b'00011000'
movwf portc
return
stoprecord
movlw b'01011100'
movwf portc
return
play
movlw b'01111100'
movwf portc
call delay10ms
movlw b'00111000'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
call delay10ms
return
stopplay
movlw b'01111100'
movwf portc
call delay10ms
movlw b'00111000'
movwf portc
call delay10ms
movlw b'01111110'
movwf portc
return
;-------------------
delay10ms
movlw d'12'
movwf DL1
delay2
movlw 0xff
movwf DL2
delay1
decfsz DL2,F
goto delay1
decfsz DL1,F
goto delay2
return
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -