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

📄 fsend.asm

📁 web51的开发库
💻 ASM
字号:
.nolist.include	"param.inc";include	"8019.inc".list	.global	flagSecure	.global	sendFile;	RSEG	CPU_BIT;;***** send file  *****	.bitcomm flagIFcgi, 1	.bitcomm flagskipL, 1	.bitcomm flagskipR, 1	.bitcomm flagSecure, 1	.bitcomm fastI2C, 1;	RSEG	CPU_DATA	.comm fileID, 2	.comm workreg, 4 	;PI2X,... work register for convert const to string;	RSEG	CPU_ROM	.textsendFile:; Acc - filesystem ID; dpl - LSB file start; dph - MSB file start; R3  - LSB file end; R2  - MSB file end.ifdef I2Cfilesystem	jz	I2Cfiles.endif.ifdef ROMfilesystem	jb	B2B(ACC,0),ROMfiles.endif.ifdef EEfilesystem	jb	B2B(ACC,1),EEfiles.endif;!!! snad alespon jeden je zapnut, takze to v nem skonci.ifdef I2CfilesystemI2Cfiles:	.using	0I2Clop:	push	ar2	;MSB	push	ar3	;LSBI2Ccur:	push	dph	push	dpl	jb	fastI2C, rch	lcall	read_random	setb	fastI2C	sjmp	rrhrch:	lcall	read_currentrrh:	lcall	httpchar	pop	dpl	;LSB file start	pop	dph	;MSB file start	pop	ar3	;LSB file end	pop	ar2	;MSB file end	inc	dptr	mov	a,dph	cjne	a,ar2,I2Clop	mov	a,dpl	cjne	a,ar3,I2Clop	ret.endif.ifdef ROMfilesystemROMfiles:;	.using	0ROMlop:	push	ar2	;MSB	push	ar3	;LSBROMcur:	push	dph	push	dpl	clr	a	movc	a,@a+dptr	lcall	httpchar	pop	dpl	;LSB file start	pop	dph	;MSB file start	pop	ar3	;LSB file end	pop	ar2	;MSB file end	inc	dptr	mov	a,dph	cjne	a,ar2,ROMlop	mov	a,dpl	cjne	a,ar3,ROMlop	ret.endif.ifdef EEfilesystemEEfiles:;	.using	0EElop:	push	ar2	;MSB	push	ar3	;LSBEEcur:	push	dph	push	dpl	ENABLE_EE	movx	a,@dptr	DISABLE_EE	lcall	httpchar	pop	dpl	;LSB file start	pop	dph	;MSB file start	.using	0	pop	ar3	;LSB file end	pop	ar2	;MSB file end	inc	dptr	mov	a,dph	cjne	a,ar2,EElop	mov	a,dpl	cjne	a,ar3,EElop	ret.endif;httpchar:	mov	r2,a	mov	a,state80	jz	nonamescan	cjne	a,#8,gohttpcharnocgistart:	mov	a,r2	ljmp	sendcharnonamescan:	jnb	flagskipL,noscanL	cjne	R2,#'{',noLeft0Br	clr	flagskipL	setb	flagskipR	retnoLeft0Br:	cjne	R2,#'}',noRight0Br	clr	flagskipL	;normal	clr	flagskipRnoRight0Br:	retnoscanL:jnb	flagskipR,noscanR	cjne	R2,#'{',noLeft1Br	setb	flagskipL	;no echo	clr	flagskipR	retnoLeft1Br:	cjne	R2,#'}',noRight1Br	clr	flagskipL	;normal	clr	flagskipR	retnoRight1Br:	mov	a,r2	ljmp	sendcharnoscanR:cjne	R2,#0x27,nocgistart ;''''	clr	flagIFcgi	inc	state80		;1	ret;gohttpchar:	add	a,acc		;sjmp = 2 byte	add	a,#LOW(http80table-2)	push	Acc		;push low addr	mov	a,#0	addc	a,#HIGH(http80table-2)	push	Acc		;push high addr	mov	a,r2	ret			;and Go!;http80table:	sjmp	testdouble	;1	sjmp	scanpoint	;2	sjmp	scanc		;3	sjmp	scang		;4	sjmp	scani		;5	sjmp	scansp		;6	sjmp	getpar		;7;testdouble:	cjne	a,#0x27,nodouble ;''''resetstate80:	mov	state80,#0	ljmp	sendcharnodouble:cjne	a,#'?',noifcgi	setb	flagIFcgi	retnoifcgi:inc	state80		;2	mov	fileID,#0	mov	fileID+1,a	ret;scanpoint:	cjne	a,#'/',nosubdir	mov	fileID,#0	mov	fileID+1,#0	retnosubdir:cjne	a,#'.',nopointgoaddst:inc	state80		;3nopoint:add	a,fileID+1	mov	fileID+1,a	mov	a,fileID	addc	a,#0	mov	fileID,a	ret;scanc:	cjne	a,#'c',resetstate80	sjmp	goaddst		;4;scang:	cjne	a,#'g',resetstate80	sjmp	goaddst		;5;scansp:	cjne	a,#'?',scanqv	inc	state80		;7	ret;scanqv:	cjne	a,#0x27,resetstate80 ;''''	mov	state80,#0execgi:	lcall	searchfile	;r4	file type				;dptr	file start				;r2r3	file end	jc	cginotfound	mov	workreg,dph	mov	workreg+1,dpl	PUSH	pcodeMSB	PUSH	pcodeLSB	lcall	pcode      	.pcode	pcall @workreg	.byte	0	POP	pcodeLSB	POP	pcodeMSBcginotfound:	mov	state80,#0	jbc	flagIFcgi,testCGIflags	clr	flagskipL	clr	flagskipR;end of exe cgi	rettestCGIflags:	mov	C,zflag	mov	flagskipL,C	cpl	C	mov	flagskipR,C	ret;scani:	cjne	a,#'i',resetstate80	sjmp	goaddst		;6;getpar:	mov	state80,a	sjmp	execgi;	;; END

⌨️ 快捷键说明

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