📄 www8051.asm
字号:
.nolist.include "param.inc".include "8019.inc".list .global flash_my_ether .global rcv_hdr .global rcv_hdr_nxt_pg .global rx_eth_bit .global buf .global bufend .global sizeofbuf .global stackOffset .global pcodeMSB .global pcodeLSB .global workreg .eeprom .equ beginconf,.flash_my_ether:.include "ether.inc";;*************************************************************; .rdatastackOffset: .ds.b 1pcodeMSB: .ds.b 1pcodeLSB: .ds.b 1workreg: .ds.b 4 ;PI2X,... work register for convert const to string .bitdatarx_eth_bit: .ds.b 1 ;Packet driver;;***** timer *****bit1ms: .ds.b 1 .data;Begin of STRUCT;SIZE_OF_8019_HDR+SIZE_OF_ETH_PKT_HDRrcv_hdr: .ds.b 1 ;Received frame statusrcv_hdr_nxt_pg: .ds.b 1 ;Page after this framercv_hdr_size: .ds.b 2 ;LSB/MSB Length of this frameeth_pkt_hdr_dest:.ds.b 6eth_pkt_hdr_src:.ds.b 6eth_pkt_hdr_type:.ds.b 2;End of STRUCTslowtimer: .ds.b 1; RSEG CPU_STACK;ISEG at 090h .idata .equ sizeofbuf,0x20buf: .ds.b sizeofbufbufend:;;*************************************************************; .text .using 0;reset: AJMP RESET_CONT;;*************************************************************; .text .org 0x0BI_TF0: ajmp IntTF0 ;1ms timer; .asciz "\r\nWWW8052 diag 1.00";;###########################################;# Timer 0 Interrupt service #;###########################################;;IntTF0: push psw push acc mov tl0,#LOW(SysTik) mov th0,#HIGH(SysTik) setb bit1ms pop acc pop psw reti;;*************************************************************;RESET_CONT: MOV P0,#-1 MOV P1,#0 MOV P2,#-1 MOV P3,#-1 MOV SP,#stack MOV R0,#0resLP: MOV @R0,#0 INC R0 MOV A,R0 JNZ resLP;; ACALL OutStrg; .asciz "\r\n89C8252 WWW server diag 1.00";.if RD2; mov CKCON, #0 ;12 clocks default; mov AUXR1, #0 ;select DPTR mov AUXR, #0b00001111; ..0..... RD/, WR/ 6 clock length; ....11.. 1024 bytes XRAM; ......1. External data memory access; .......1 ALE only if MOVX or MOVC .endif mov P1,#0b11000000 lcall network_init mov P1,#0b01000000 mov stackOffset,#stack0offset ;service stack;;#########################################################; Main Loop;#########################################################; mov workreg,#0x80 mov workreg+1,#0x80mainloop: RESTART_WD; lcall sstat ;scan RTS/CTS,... clr rx_eth_bit ;clear rx_eth_bit LCALL rcv_pkt jnb rx_eth_bit,NoRxEth inc workreg mov A,workreg mov C,acc.7 anl C,acc.1 mov LED0,CNoRxEth: lcall TestPaket inc workreg+1 mov A,workreg+1 mov C,acc.7 anl C,acc.1 mov LED1,C mov P1,#0b10000000 ajmp mainloop;;**************************************************************************arpgwreq: .word 0xFFFF,0xFFFF,0xFFFF ;PKT_DEST (Broadcast Address).include "ether.inc" ;PKT_SRC = myether .word 0x0806 ;PKT_TYPE ;0806 = ARP .word 0x0001 ;ARP_HWTYPE ;hardware type 0001 .word 0x0800 ;ARP_PRTYPE ;protocol type 0800 .byte 6 ;ARP_HWLEN ;hardware address length 06 .byte 4 ;ARP_PRLEN ;protocol address length 04 .word ARPT_RQ ;ARP operation (1=request, 2=reply).include "ether.inc" ;senders hardware address = myether .byte 192 ;senders IP address = myip .byte 168 .byte 1 .byte 89 .word 0,0,0 ;target hardware address .byte 192 ;target IP address .byte 168 .byte 1 .byte 88 .equ sizeofarpgwreq,(. - arpgwreq)TestPaket: LCALL pcode;; tx_eth_pkt.hdr.pktDest = eth_brdcast; //Broadcast Address;; tx_eth_pkt.hdr.pktSrc = flash_my_ether; //packet source address;; tx_eth_pkt.hdr.pktType = 0x0806; //ARP;; tx_eth_pkt.pkt.arp.HwType = 0x0001; //hardware type;; tx_eth_pkt.pkt.arp.PrType = 0x0800; //protocol type;; tx_eth_pkt.pkt.arp.HwLen = 6; //hardware address length;; tx_eth_pkt.pkt.arp.PrLen = 4; //protocol address length;; tx_eth_pkt.pkt.arp.Op = ARPT_RQ; //ARP operation (1=request, 2=reply);; tx_eth_pkt.pkt.arp.SHwA = flash_my_ether; //senders hardware address;; tx_eth_pkt.pkt.arp.SIPA = flash_my_ip; //senders IP address;; tx_eth_pkt.pkt.arp.THwA = eth_zero; //target hardware address;; tx_eth_pkt.pkt.arp.TIPA = flash_ip_gateway; //target IP address ;DP_W_ pc2x, none, PKT_DEST, arpgwreq, sizeofarpgwreq .pcode pc2x PKT_DEST, arpgwreq, #BYTE sizeofarpgwreq;; xmit_frame(sizeof(rx_eth_pkt.hdr) + sizeof(rx_eth_pkt.pkt.arp)); ;DP xmit_frame, none, SIZE_OF_ETH_PKT_HDR+SIZE_OF_ARP, blank, blank .pcode xmit_frame #SIZE_OF_ETH_PKT_HDR+SIZE_OF_ARP;; return; .byte 0 RET;.global intRITIintRITI: reti ;don't link serial.obj .ascii "Tady je vata pro doplneni na minimalne 100 hexa" .ascii "procedury PCODE musi byt nad hranici 0100h";;*************************************************************; ;; END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -