×

PS2键盘转USB键盘源码

消耗积分:1 | 格式:rar | 大小:26KB | 2017-05-04

lilun

分享资料个

PS2键盘转USB键盘

  ; 1、

  ; 2、

  ; 3、

  ; 4、

  ; 5、CLOSE THE USB PULLDE-HIGH IN THE PS2 MODE

  ;=====================================================

  ;=======================================================

  INCLUDE (INITIALIZE.INC)

  CSEG 0X0000

  JMP PowerOn ;CheckSum:2cedb811H

  ;CheckSum:e15558a7H

  ;************************************

  CSEG 0X0001

  MOV A_Buffer,A

  SWPA R3

  MOV R3_Buffer,A

  MOV A,R_OMCR

  MOV RA_Buffer,A

  MOV A,R4

  MOV R4_Buffer,A

  PAGE0

  SBZ R_ISR,0 ;JUDGE INTERRUPT SOURCE

  JMP P0_TCC_INT

  SBZ R_ISR,1

  JMP P0_EPT2_INT

  SBZ R_ISR,2

  JMP P0_EPT1_INT

  SBZ R_ISR,3

  JMP P0_EPT0_INT

  SBZ R_ISR,5

  JMP P0_URST_INT

  ; SBZ R_ISR,6

  ; JMP P0_ADI_INT

  SBZ R_ISR,7

  JMP P0_PORT7_INT

  JMP P0_L_INTRETURNPUBLIC

  ;--------------------------------------

  P0_URST_INT: ;index

  MOV A,11011111B

  MOV R_ISR,A

  BANK2

  BST B2_USB_FLAG,USB_RST

  CLR B2_USBRSTCNT

  ; BCLR MouseFlag,bEnumOk

  JMP P0_L_INTRETURNPUBLIC

  ;***********************************

  ;P0_ADI_INT:

  ; MOV A,10111111B

  ; MOV R_ISR,A

  ; JMP P0_L_IntReturnPublic

  ;************************************

  P0_PORT7_INT:

  MOV A,01111111B

  MOV R_ISR,A

  BST NumLock_FLAG,P2IntFlag

  bank2

  inc B2_P2Int_Times

  JMP P0_L_IntReturnPublic

  ;************************************

  P0_TCC_INT:

  MOV A,11111110B

  MOV R_ISR,A

  mov a,00

  mov TCC,a

  ; BANK2

  ; inc B2_MouseInterval

  ; mov a,B2_MouseInterval

  ; xor a,2

  ; sbnz STATUS,Z

  ; JMP P0_L_IntReturnPublic

  ; clr B2_MouseInterval

  ; SBNZ B2_USB_FLAG,SETCONFIG

  ; JMP P0_L_IntReturnPublic

  ; PAGE6

  ; call MouseDataToHost

  ; page0

  BST MouseFlag,bInterval

  ; JMP P0_L_IntReturnPublic

  jmp P0_L_IntExit

  ;**************************************

  P0_EPT2_INT:

  MOV A,11111101B

  MOV R_ISR,A

  ; BCLR MouseFlag,bEP2

  ; JMP P0_L_IntReturnPublic

  JMP P0_EP12_COM

  ;***************************************

  P0_EPT1_INT:

  MOV A,11111011B

  MOV R_ISR,A

  P0_EP12_COM:

  BANK2

  ;BCLR B2_USB_FLAG,USB_RST

  CLR B2_EP1_NONECNT0

  BCLR B2_USB_FLAG,EP1_BSY

  JMP P0_L_IntReturnPublic

  ;***************************************

  P0_EPT0_INT:

  BANK2

  MOV A,11110111B

  MOV R_ISR,A

  CLR B2_USBRSTCNT

  P0_EP0_INT_FUN:

  MOV A,0

  MOV R_UCR,A ;GET EPT0 CTL REGISTER VALUE

  SBZ R_UDR,DIR ;if dir=0 host command maybe setup packeg or out packet

  JMP P0_ProcessUsbTx0INT ;if dir=1 host command is IN pagcket

  SBNZ R_UDR,CMD ;if cmd=1 host is setup packet

  JMP P0_Function_Report_data ;if cmd=0 host is report data packet

  JMP P0_FunctionRequestReceived

  P0_ProcessUsbTx0INT:

  SBZ B2_USB_FLAG,REPORTLED

  JMP P0_LEDREPORT_TX ;setreport packege‘s acvk IN null packege

  sbz NumLock_FLAG,bCmdFeature

  jmp P0_DisaFeature_TX

  SBNZ B2_USB_FLAG,ADDRESS ;set address null IN akc packege

  JMP P0_SendNextBuffer

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(1)
发评论
sh_amino 2017-07-02
0 回复 举报
看一下,谢谢分享,多谢楼主! 收起回复

下载排行榜

全部1条评论

快来发表一下你的评论吧 !