⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cls.asm

📁 HT82J97滑鼠DEMO程序
💻 ASM
字号:
include		body.inc
include		usbfifo.inc
include		usbrf1.inc	

;extern		AddBufAddr		:near
;extern		pCurRecv		:byte		;serial.asm
;extern		pStartRecv		:byte
;extern		br_index		:byte

;extern		bDataUpdate		:bit
extern		nCmdIndex		:byte		;variable.asm
extern		fifo_type		:byte	
extern		FIFO_Request	:byte
extern		fifo_wIndexl	:byte
extern		FIFO_wIndexH 	:byte
extern		FIFO_wValueL 	:byte
extern		FIFO_wValueH	:byte
extern		FIFO_wLengthH	:byte
extern		FIFO_wLengthL	:byte

extern		fifo_out1		:byte
extern		fifo_out2		:byte
extern		fifo_out3		:byte
extern		fifo_out4		:byte
extern		fifo_out5		:byte
extern		fifo_out6		:byte
extern		fifo_out7		:byte
extern		fifo_out8		:byte

Extern		ExitExt			:NEAR
EXTERN		ToStallPipe0	:NEAR
EXTERN		SendFIFOOut		:NEAR
EXTERN		SendHandshake	:NEAR

;**********************************************
; extern function from serial.asm
;**********************************************
EXTERN		ToUSB		:NEAR	;serial.asm

extern		INT_temp2		:byte
TEMP		EQU				INT_TEMP2


CLS1		.SECTION at 1d0h 'code'
;-------------- Class-Specific request -----------------------------------------------
SetProtocol:	
GetProtocol:
SetIdle:
GetIdle:
            JMP				ToStallPipe0           ;Not support: to stall

;----------------------------------------------------------------------------
ClassRequest:
            MOV     		A,FIFO_Type
            AND     		A,Setup_Rev
            MOV     		TEMP,A
            SUB     		A,04H               	;Over 4 item ?
            SZ      		C                   	;
            JMP				ToStallPipe0        	;Yes
            MOV				A,TEMP
class_request_pcl_5:
            ADDM			A,PCL
            JMP				ToStallPipe0        	;Invalid Device
            JMP				InterfaceRev        	;Invalid Interface
            JMP				ToStallPipe0        	;Endpoint
            JMP				ToStallPipe0        	;Invalid Other

InterfaceRev:
			SZ				FIFO_wIndexH        	;High byte for endpoint == 0 ?
            JMP				ToStallPipe0        	;No
			MOV				A,FIFO_wIndexL	
			SUB				A,INTERFACE_NO			;2
			SZ				C
			JMP				ToStallPipe0

;Check bRequest		
            MOV				A,FIFO_Request    		;bRequest
            SUB				A,CLASS_REQUEST_NO  	;Over 12 item ?
            SZ				C                   	;
            JMP				ToStallPipe0        	;Yes
            MOV				A,FIFO_Request
;!!!!! Need in same page
class_cmd_pcl_13:
            ADDM			A,PCL
            JMP				ToStallPipe0        	;0
            JMP				GetReport           	;1 
            JMP				GetIdle             	;2
            JMP				GetProtocol         	;3
            JMP				ToStallPipe0        	;4
            JMP				ToStallPipe0        	;5
            JMP				ToStallPipe0        	;6
            JMP				ToStallPipe0        	;7
            JMP				ToStallPipe0        	;8
            JMP				SetReport           	;9
            JMP				SetIdle             	;A
            JMP				SetProtocol         	;B

;////////////////////////////////////////////////////////////////////////////
;Class Specific Request
ReportVL:
            MOV				FIFO_OUT1,A       		;
            MOV				A,OUTPUT_SIZE       	;FIFO data length = 1
			jmp				SendFIFOOut

;----------------------------------------------------------------------------
GetReport:	;Report_type, Report_ID=0, Report_Length 
			;no Feature Report
            ;Check bmRequestType direction
            SNZ				FIFO_Type.@Setup_D    	;device to host ?
            JMP				ToStallPipe0            ;No:Error
            MOV				A,FIFO_wValueH        	;Get report type (Only 3 kind)
            SUB				A,REPORT_TYPE_NO	    ;Over 4 item ?
            SZ				C                       ;
            JMP				ToStallPipe0            ;Yes
            MOV				A,FIFO_wValueH
get_report_pcl_5:
            ADDM			A,PCL
            JMP				ToStallPipe0            ;No this report type
            JMP				GetInputReport			;intput
            JMP				Tostallpipe0			;output		
GetFeatureReport:									;No support GetFeatureReport
			jmp				ToStallPipe0

;----------------------------------------------------------------------------
GetInputReport:
            SZ				FIFO_wLengthH     		;wLength = 8 ?
            JMP				ToStallPipe0        	;No
			
			mov				a,FIFO_wIndexL
get_input_pcl_4:
			addm			a,pcl
			jmp				Get_Input_Data			;report id:0
			jmp				Tostallpipe0			;report id:1

Get_Input_Data:
			MOV				A,FIFO_wLengthL     	;check format no.
            XOR				A,INPUT_SIZE       	;
            SNZ				Z                   	;
            JMP				ToStallPipe0        	;

			;****************************************
			; Move SF880 Data to FIFO_OUT
			;****************************************
			call			ToUSB

			mov				a, INPUT_SIZE
			jmp				SendFIFOOut

;----------------------------------------------------------------------------
SetReport:		
			;Report_Type, Report_ID=0, 
            ;Check bmRequestType direction
			;No Feature Report, Input Report
            SZ				FIFO_Type.@Setup_D    	;Host to device ?
            JMP				ToStallPipe0            ;No:Error
            MOV				A,FIFO_wValueH        	;Get report type (Only 3 kind)
            SUB				A,04H                   ;Over 4 item ?
            SZ				C                       ;
            JMP				ToStallPipe0            ;Yes
            MOV				A,FIFO_wValueH
setreport_pcl_5:
            ADDM			A,PCL
            JMP				ToStallPipe0            ;No this report type
            JMP				ToStallPipe0            ;No support SetInputReport
            JMP				SetOutputReport
SetFeatureReport:									;No support SetFeatureReport
    	    JMP				ToStallPipe0            ;No

SetOutputReport:
			SZ				FIFO_wIndexL			;interface 0
			JMP				ToStallPipe0
			SZ				FIFO_wLengthH         	;wLength = 0 ?
            JMP				ToStallPipe0            ;No
            MOV				A,FIFO_wLengthL       	;8 byte report
            XOR				A,OUTPUT_SIZE			;KB_Output_SIZE    	;
            SNZ				Z                       ;
    	    JMP				ToStallPipe0            ;No
			MOV				A,SET_REPORT
			MOV				nCmdIndex,a
            JMP				ExitExt        	                

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PUBLIC		ClassRequest
public		class_request_pcl_5
public		class_cmd_pcl_13
public		setreport_pcl_5
END

⌨️ 快捷键说明

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