📄 ir_as1213.asm
字号:
.ifnz IR_AS1213
inc MarkCounter
inc SpaceCounter
inc SyncCounter
inc Bit01Counter
;;-----------------------------------------------
SRAM_PG1: .section ;;PAGE1 start
;;-----------------------------------------------
lda IrStateFlag
cmp #IR_MARK_STATE
beq ProcesSmark
cmp #IR_SPACE_STATE
beq ProcessSpace
cmp #IR_SYNC_STATE
beq ProcessSync
cmp #IR_BIT01_STATE
beq ProcessBit01
cmp #IR_REPEAT_STATE
beq PreProcessRepeat
cmp #BEGIN_FROM_HEAD
beq StartProgram
bra StartProgram
PreProcessRepeat:
jmp ProcessRepeat
StartProgram:
lda IR_PORT
and #IR_IN
bne DirectExit
stz MarkCounter
lda #IR_MARK_STATE
sta IrStateFlag
DirectExit:
jmp EndExit
ProcesSmark:
lda IR_PORT
and #IR_IN
beq Exit1
lda MarkCounter
cmp #37 ;;40
bcc LongJmp1
lda #IR_SPACE_STATE
sta IrStateFlag
stz SpaceCounter
Exit1:
jmp EndExit
LongJmp1:
jmp FromHeadStart
;------------------------------------------------------------------
ProcessSpace:
lda IR_PORT
and #IR_IN
bne Exit2
lda SpaceCounter
cmp #37 ;;40
bcc LongJmp2
lda #IR_SYNC_STATE
sta IrStateFlag
stz SyncCounter
Exit2:
jmp EndExit
LongJmp2:
jmp FromHeadStart
;------------------------------------------------------------------
ProcessSync:
lda IR_PORT
and #IR_IN
beq Exit3
lda SyncCounter
cmp #3 ;;5
bcc FromHeadStart
lda #IR_BIT01_STATE
sta IrStateFlag
stz Bit01Counter
Exit3:
jmp EndExit
;------------------------------------------------------------------
ProcessBit01:
lda Bit01Counter
cmp #20
bcs RecRepCode
lda IR_PORT
and #IR_IN
bne Exit4
lda Bit01Counter
cmp #12 ;;15
bcc CheckNext
lda #1
sta BitIs1
inc BitsCounter
lda #IR_SYNC_STATE
sta IrStateFlag
stz SyncCounter
bra Exit4
CheckNext:
lda Bit01Counter
cmp #3 ;;5
bcc FromHeadStart
lda #1
sta BitIs0
inc BitsCounter
lda #IR_SYNC_STATE
sta IrStateFlag
stz SyncCounter
Exit4:
jmp PreIrqExit
;------------------------------------------------------------------
RecRepCode:
lda #IR_REPEAT_STATE
sta IrStateFlag
jmp EndExit
ProcessRepeat:
inc RepRate
lda RepRate
cmp #5
bne clearrepflag
stz RepRate
lda IOP_DATA5_H
ora #%11000000
sta IOP_DATA5_H
lda Repdata
sta IOP_DATA5_L
bra FromHeadStart
clearrepflag:
lda IOP_DATA5_H
and #%10111111
sta IOP_DATA5_H
;------------------------------------------------------------------
FromHeadStart:
lda #BEGIN_FROM_HEAD
sta IrStateFlag
stz BitsCounter
jmp EndExit
;------------------------------------------------------------------
PreIrqExit:
lda BitIs0
cmp #1
bne CheckNextBit
stz BitIs0
clc
bra ReceiveData
CheckNextBit:
lda BitIs1
cmp #1
bne EndExit
stz BitIs1
sec
ReceiveData:
rol rReceive1
rol rReceive2
rol rReceive3
rol rReceive4
lda BitsCounter
cmp #32
beq SendToRisc
bra EndExit
;------------------------------------------------------------------
SendToRisc:
lda rReceive1
eor rReceive2
cmp #$ff
bne next
lda IOP_DATA5_H
ora #$80
sta IOP_DATA5_H
lda rReceive2
sta IOP_DATA5_L
lda rReceive2
sta Repdata
lda rReceive3
sta IOP_DATA6_L
lda rReceive4
sta IOP_DATA6_H
next:
stz rReceive1
stz rReceive2
stz rReceive3
stz rReceive4
stz BitsCounter
lda #BEGIN_FROM_HEAD
sta IrStateFlag
EndExit:
jmp lIrqIrExit
.endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -