mirror of
https://github.com/romychs/ESPKit.git
synced 2025-07-05 00:57:39 +03:00
fixed proc to build wr and rw packets
This commit is contained in:
parent
6aa509d427
commit
0048fbb929
2
sources/DSS/.vscode/tasks.json
vendored
2
sources/DSS/.vscode/tasks.json
vendored
@ -166,7 +166,7 @@
|
|||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8,19 +8,19 @@
|
|||||||
MODULE TFTP
|
MODULE TFTP
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Operation codes 2b for tftp packet header
|
; Operation codes 2b for tftp packet header (bytes swapped)
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
|
|
||||||
; Opcode Read Request
|
; Opcode Read Request
|
||||||
OP_RRQ EQU '01'
|
OP_RRQ EQU '10'
|
||||||
; Opcode Write Request
|
; Opcode Write Request
|
||||||
OP_WRQ EQU '02'
|
OP_WRQ EQU '20'
|
||||||
; Opcode Data packet
|
; Opcode Data packet
|
||||||
OP_DATA EQU '03'
|
OP_DATA EQU '30'
|
||||||
; Opcode Acknowledge packet
|
; Opcode Acknowledge packet
|
||||||
OP_ACK EQU '04'
|
OP_ACK EQU '40'
|
||||||
; Opcode Error packet
|
; Opcode Error packet
|
||||||
OP_ERROR EQU '05'
|
OP_ERROR EQU '50'
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Build packet for request file from TFTF-server
|
; Build packet for request file from TFTF-server
|
||||||
@ -30,7 +30,7 @@ BUILD_RRQ_PACKET
|
|||||||
PUSH DE
|
PUSH DE
|
||||||
LD DE,OP_RRQ ; opcode
|
LD DE,OP_RRQ ; opcode
|
||||||
CALL .BUILD_RW_PACKET
|
CALL .BUILD_RW_PACKET
|
||||||
POP HL,DE
|
POP DE
|
||||||
RET
|
RET
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -40,15 +40,14 @@ BUILD_RRQ_PACKET
|
|||||||
PUSH DE
|
PUSH DE
|
||||||
LD DE,OP_WRQ ; opcode
|
LD DE,OP_WRQ ; opcode
|
||||||
CALL .BUILD_RW_PACKET
|
CALL .BUILD_RW_PACKET
|
||||||
POP HL,DE
|
POP DE
|
||||||
RET
|
RET
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Build packet for write file or receive form TFTF-server
|
; Build packet for write file or receive form TFTF-server
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
.BUILD_RW_PACKET
|
.BUILD_RW_PACKET
|
||||||
LD HL,TFTP_BUFF
|
LD HL,TFTP_BUFF
|
||||||
PUSH HL
|
|
||||||
LD (HL), DE
|
LD (HL), DE
|
||||||
INC HL
|
INC HL
|
||||||
INC HL
|
INC HL
|
||||||
@ -65,14 +64,24 @@ BUILD_RRQ_PACKET
|
|||||||
; Mode 'octet'Z
|
; Mode 'octet'Z
|
||||||
.BRP_MOD
|
.BRP_MOD
|
||||||
INC HL
|
INC HL
|
||||||
LD DE,'ct'
|
LD DE,'co'
|
||||||
LD (HL),DE
|
LD (HL),DE
|
||||||
INC HL
|
INC HL
|
||||||
|
INC HL
|
||||||
LD DE,'et'
|
LD DE,'et'
|
||||||
LD (HL),DE
|
LD (HL),DE
|
||||||
INC HL
|
INC HL
|
||||||
|
INC HL
|
||||||
LD DE,'t'
|
LD DE,'t'
|
||||||
LD (HL),DE
|
LD (HL),DE
|
||||||
|
INC HL
|
||||||
|
INC HL
|
||||||
|
; Calculate packet length
|
||||||
|
LD DE, TFTP_BUFF
|
||||||
|
SBC HL,DE
|
||||||
|
EX DE,HL
|
||||||
|
LD HL,TFTF_PACKET_LEN
|
||||||
|
LD (HL),DE
|
||||||
RET
|
RET
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -157,6 +166,8 @@ CHK_ERROR
|
|||||||
DB "Unknown TFTP packet received!"Z
|
DB "Unknown TFTP packet received!"Z
|
||||||
|
|
||||||
; Buffer for UDP datagram with TFTP payload
|
; Buffer for UDP datagram with TFTP payload
|
||||||
|
TFTF_PACKET_LEN
|
||||||
|
DW 0
|
||||||
TFTP_BUFF
|
TFTP_BUFF
|
||||||
DS 516,0
|
DS 516,0
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
; Set to 1 to turn debug ON with DeZog VSCode plugin
|
; Set to 1 to turn debug ON with DeZog VSCode plugin
|
||||||
; Set to 0 to compile .EXE
|
; Set to 0 to compile .EXE
|
||||||
; DEFINE DEBUG
|
DEFINE DEBUG
|
||||||
|
|
||||||
; Set to 1 to output TRACE messages
|
; Set to 1 to output TRACE messages
|
||||||
DEFINE TRACE
|
DEFINE TRACE
|
||||||
@ -62,7 +62,7 @@ EXE_HEADER
|
|||||||
START
|
START
|
||||||
|
|
||||||
IFDEF DEBUG
|
IFDEF DEBUG
|
||||||
LD IX,CMD_LINE_TFTP_D1
|
LD IX,CMD_LINE_TFTP_U
|
||||||
LD SP, STACK_TOP
|
LD SP, STACK_TOP
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
@ -121,6 +121,7 @@ OK_EXIT
|
|||||||
JP WCOMMON.EXIT
|
JP WCOMMON.EXIT
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
|
; Parse command line parameters
|
||||||
; IX - points to cmd line
|
; IX - points to cmd line
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
PARSE_CMD_LINE
|
PARSE_CMD_LINE
|
||||||
@ -174,7 +175,6 @@ OUT_USAGE_MSG
|
|||||||
PRINTLN MSG_HLP
|
PRINTLN MSG_HLP
|
||||||
JP OK_EXIT
|
JP OK_EXIT
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Move srv name and port number from (HL) to (DE)
|
; Move srv name and port number from (HL) to (DE)
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -237,8 +237,6 @@ GET_SRV_PARAMS
|
|||||||
.GDNF_NXT
|
.GDNF_NXT
|
||||||
INC HL
|
INC HL
|
||||||
LD A,(HL)
|
LD A,(HL)
|
||||||
; OR A
|
|
||||||
; JR Z,.GDNF_END
|
|
||||||
CP 0x21
|
CP 0x21
|
||||||
JP M,.GDNF_END
|
JP M,.GDNF_END
|
||||||
LD (DE),A
|
LD (DE),A
|
||||||
@ -261,8 +259,8 @@ GET_SRV_PARAMS
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Get local file name from command string
|
; Get local file name from command line
|
||||||
;
|
; Inp: HL -> command line
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
GET_LFN
|
GET_LFN
|
||||||
PUSH BC,DE
|
PUSH BC,DE
|
||||||
@ -342,7 +340,6 @@ OPEN_LOCAL_FILE
|
|||||||
JR NZ,.OLF_SKP_CP
|
JR NZ,.OLF_SKP_CP
|
||||||
|
|
||||||
LD HL, @TMP_BUFF
|
LD HL, @TMP_BUFF
|
||||||
;PUSH HL
|
|
||||||
CALL UTIL.GET_CUR_DIR
|
CALL UTIL.GET_CUR_DIR
|
||||||
LD DE,LOC_FILE
|
LD DE,LOC_FILE
|
||||||
LD B,128
|
LD B,128
|
||||||
@ -356,7 +353,6 @@ OPEN_LOCAL_FILE
|
|||||||
DJNZ .OLF_NXT
|
DJNZ .OLF_NXT
|
||||||
.OLF_EFN
|
.OLF_EFN
|
||||||
LD HL, @TMP_BUFF
|
LD HL, @TMP_BUFF
|
||||||
;POP HL
|
|
||||||
|
|
||||||
; HL - points to file path name
|
; HL - points to file path name
|
||||||
.OLF_SKP_CP
|
.OLF_SKP_CP
|
||||||
@ -432,8 +428,6 @@ CLOSE_LOCAL_FILE
|
|||||||
CALL DSS_ERROR.CHECK
|
CALL DSS_ERROR.CHECK
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Display current working mode
|
; Display current working mode
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user