📄 main.asm
字号:
;====================================================================================
; The information contained herein is the exclusive property of
; Sunplus Technology Co. And shall not be distributed, reproduced,
; or disclosed in whole in part without prior written permission.
; (C) COPYRIGHT 2004 SUNPLUS TECHNOLOGY CO.
; ALL RIGHTS RESERVED
; The entire notice above must be reproduced on all authorized copies.
;====================================================================================
;====================================================================================
; Program Name: main.asm
; Applied body: SPMC65P2404*28P
; Description: The program presents an example of receiving and showing datats
; through IR.
; Reference: SPMC65P2404 Programming Guide
; Author: Hailong Jiang/Sunnorth
; Revision history:
;------------------------------------------------------------------------------------
; Version Date Modify By Description
; 1.0.0 2004-12-13 Hailong Jiang First Edition
;====================================================================================
.SYNTAX 6502 ;Process standard 6502 addressing syntax
.LINKLIST ;Generate linklist information
.SYMBOLS ;Generate symbolic debug information
;************************************************************************************
;* *
;* System Register Define *
;* *
;************************************************************************************
;------------------------------------------------------------------------------------
SPMC65P2404Ax .EQU 1 ;Use body: SPMC65P2404*28P
;-----------------------------------------------------------------------------------
.INCLUDE Spmc65.inc ;Define all hardware,Registers and ports.
;************************************************************************************
;* *
;* Data memory Define *
;* *
;************************************************************************************
.PAGE0 ;Define values in the range from 00h to FFh
.DATA ;Define data storage section
;************************************************************************************ *
;* Program Area *
;***********************************************************************************
.CODE
.INCLUDE IR.asm
;************************************************************************************
;* *
;* Power on Reset Process *
;* *
;************************************************************************************
.PUBLIC V_Reset
V_Reset:
sei ;Disable interrupt
ldx #C_STACK_BOTTOM ;Initial stack pointer at $00FF
txs
jsr F_IR_Init
cli
L_Main:
ldx #0
?L_Loop:
lda P_INT_Flag2
and #C_INT_TVALIF ;Check Timer base INT?
beq ?L_Loop ;No
lda #C_INT_TVALIF
sta P_INT_Flag2 ;Clear INT request flag
inx
cpx #4 ;4 ms coming?
bcc ?L_Loop ;no
jsr F_Data_Change ;convert received datas to key value
jsr F_IR_LED ;LED showing
jmp L_Main
;************************************************************************************
;* *
;* Interrupt Service Process *
;* *
;************************************************************************************
V_IRQ:
pha
txa
pha
lda P_INT_Flag0
and #C_INT_CAP3F ;CAP3 INT?
beq ?_T1_end ;NO
;--------------------------------------------------------
;CAP3 interrupt process service
jsr F_IR_Receive ;receive data
lda #$FF
STA P_INT_Flag0
?_T1_end:
pla
tax
pla
rti
V_NMI:
rti
;************************************************************************************
;* *
;* Interrupt Vector Table *
;* *
;************************************************************************************
VECTOR .SECTION
DW V_NMI ;Non-mask interrupt vector(no use)
DW V_Reset ;Reset vector
DW V_IRQ ;IRQ interrupt vector
;************************************************************************************
;* *
;* End of Interrupt Vector Table *
;* *
;************************************************************************************
.END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -