MDL Optimizer VSCode integration. Optimize code.

This commit is contained in:
boykovra 2024-08-29 11:23:11 +03:00
parent 5c34c5659f
commit 5fb3ff48fa
15 changed files with 425 additions and 457 deletions

View File

@ -1,185 +1,203 @@
{ {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{
"label": "make ESPSET (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=espset.sld",
"--sym=espset.labels",
"--raw=espset.exe",
"--fullpath",
"espset.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": false
}
},
{ {
"label": "make WTERM (sjasmplus)", "label": "make ESPSET (sjasmplus)",
"type": "shell", "type": "shell",
"command": "sjasmplus", "command": "sjasmplus",
"args": [ "args": [
"--sld=wterm.sld", "--sld=espset.sld",
"--sym=wterm.labels", "--sym=espset.labels",
"--raw=wterm.exe", "--raw=espset.exe",
"--fullpath", "--fullpath",
"wterm.asm" "espset.asm"
], ],
"problemMatcher": { "problemMatcher": {
"owner": "sjasmplus", "owner": "sjasmplus",
"fileLocation": "autoDetect", "fileLocation": "autoDetect",
"pattern": { "pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$", "regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1, "file": 1,
"line": 2, "line": 2,
"severity": 3, "severity": 3,
"message": 4 "message": 4
} }
}, },
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": false "isDefault": false
} }
}, },
{ {
"label": "make ISA-TEST (sjasmplus)", "label": "make WTERM (sjasmplus)",
"type": "shell", "type": "shell",
"command": "sjasmplus", "command": "sjasmplus",
"args": [ "args": [
"--sld=isa-test.sld", "--sld=wterm.sld",
"--sym=isa-test.labels", "--sym=wterm.labels",
"--raw=isa-test.exe", "--raw=wterm.exe",
"--fullpath", "--fullpath",
"isa-test.asm" "wterm.asm"
], ],
"problemMatcher": { "problemMatcher": {
"owner": "sjasmplus", "owner": "sjasmplus",
"fileLocation": "autoDetect", "fileLocation": "autoDetect",
"pattern": { "pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$", "regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1, "file": 1,
"line": 2, "line": 2,
"severity": 3, "severity": 3,
"message": 4 "message": 4
} }
}, },
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": false "isDefault": false
} }
}, },
{
"label": "make ESPLIB (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=esplib.sld",
"--sym=esplib.labels",
"--raw=esplib.exe",
"--fullpath",
"esplib.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "make WTFTP (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=wtftp.sld",
"--sym=wtftp.labels",
"--raw=wtftp.exe",
"--fullpath",
"wtftp.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "make CMDTEST (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=cmdtest.sld",
"--sym=cmdtest.labels",
"--raw=cmdtest.exe",
"--fullpath",
"cmdtest.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": false
}
},
{ {
"label": "start mame", "label": "make ISA-TEST (sjasmplus)",
"type": "shell", "type": "shell",
"command": "while true; do ./mame spectrum -window -debugger gdbstub -debug -debugger_port 12000 -verbose -resolution 512x384 ; sleep 2 ; done", "command": "sjasmplus",
"options": { "args": [
"cwd": "${config:mame_dir}" "--sld=isa-test.sld",
}, "--sym=isa-test.labels",
"problemMatcher": [] "--raw=isa-test.exe",
} "--fullpath",
] "isa-test.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "make ESPLIB (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=esplib.sld",
"--sym=esplib.labels",
"--raw=esplib.exe",
"--fullpath",
"esplib.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "make WTFTP (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=wtftp.sld",
"--sym=wtftp.labels",
"--raw=wtftp.exe",
"--fullpath",
"wtftp.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "MDL for WTFTP",
"type": "shell",
"command": "java -jar ~/Soft/MDL/mdl.jar wtftp.asm -cpu z180 -po -dialect sjasmplus",
"group": "build",
"problemMatcher": {
"applyTo": "allDocuments",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": [
{
"regexp": "^(\\w+): (.+) in (.+)#([0-9]+): (.+)$",
"file": 3,
"line": 4,
"severity": 1,
"message": 5,
"code": 2
}
]
},
"presentation": {
"echo": false,
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"revealProblems": "onProblem"
}
},
{
"label": "MDL for WTERM",
"type": "shell",
"command": "java -jar ~/Soft/MDL/mdl.jar wterm.asm -cpu z180 -po -dialect sjasmplus",
"group": "build",
"problemMatcher": {
"applyTo": "allDocuments",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": [
{
"regexp": "^(\\w+): (.+) in (.+)#([0-9]+): (.+)$",
"file": 3,
"line": 4,
"severity": 1,
"message": 5,
"code": 2
}
]
},
"presentation": {
"echo": false,
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"revealProblems": "onProblem"
}
}
]
} }

View File

@ -3,6 +3,8 @@
; By Roman Boykov. Copyright (c) 2024 ; By Roman Boykov. Copyright (c) 2024
; https://github.com/romychs ; https://github.com/romychs
; ====================================================== ; ======================================================
IFNDEF _BUFFER
DEFINE _BUFFER
MODULE BUFFER MODULE BUFFER
@ -186,4 +188,6 @@ SAVE_P1
ORG 0x5000 ORG 0x5000
RX_BUFFER RX_BUFFER
ENDMODULE ENDMODULE
ENDIF

View File

@ -56,12 +56,12 @@ START
MSG_CMDLINE MSG_CMDLINE
DB "\r\nCommandline:"Z DB "\r\nCommandline:",0
MSG_CURPATH MSG_CURPATH
DB "\r\nExePath:"Z DB "\r\nExePath:",0
MSG_LINE_END MSG_LINE_END
DB "\r\n"Z DB "\r\n",0
ENDMODULE ENDMODULE

View File

@ -3,6 +3,8 @@
; By Roman Boykov. Copyright (c) 2024 ; By Roman Boykov. Copyright (c) 2024
; https://github.com/romychs ; https://github.com/romychs
; ====================================================== ; ======================================================
IFNDEF _DSS
DEFINE _DSS
ORG 0x0000 ORG 0x0000
@ -187,8 +189,8 @@ REMAINS_IN_ZIP
_READ_FILE _READ_FILE
OR A OR A
JP Z, BAD_EXIT JP Z, BAD_EXIT
PUSH DE LD B,D ; BC - bytes to read
POP BC ; BC - bytes to read LD C,E
PUSH HL PUSH HL
LD HL, (CUR_F_PTR) ; HL -> IN ZIP_FILE LD HL, (CUR_F_PTR) ; HL -> IN ZIP_FILE
@ -223,8 +225,8 @@ NO_OUT_OF_ZIP
; DE - реальное количество записанных байт ; DE - реальное количество записанных байт
_WRITE_FILE _WRITE_FILE
PUSH DE LD B, D
POP BC LD C, E
LD DE,OUT_FILE LD DE,OUT_FILE
PUSH BC PUSH BC
@ -304,9 +306,9 @@ _SCANKEY
_WAITKEY _WAITKEY
XOR A XOR A
LD D, A LD D, A
LD C, A ;LD C, A
LD E,65 LD E,65
LD A,65 LD A,E
JP NORM_EXIT JP NORM_EXIT
@ -361,16 +363,16 @@ _EXIT
JP _EXIT JP _EXIT
CMD_LINE_TFTP_D CMD_LINE_TFTP_D
DB " tftp://tftp.server.ru:1024/file_in.asm c:\\tmp\\file_out.asm"Z DB " tftp://tftp.server.ru:1024/file_in.asm c:\\tmp\\file_out.asm",0
CMD_LINE_TFTP_D1 CMD_LINE_TFTP_D1
DB " tftp://server.ru/file.src sss.dst"Z DB " tftp://server.ru/file.src sss.dst",0
CMD_LINE_TFTP_U CMD_LINE_TFTP_U
DB " file_from.asm tftp://server.ru:9999/file_to.asm"Z DB " file_from.asm tftp://server.ru:9999/file_to.asm",0
CMD_LINE_TFTP_U1 CMD_LINE_TFTP_U1
DB " file_up.txt"Z DB " file_up.txt",0
IN_FILE IN_FILE
@ -381,4 +383,6 @@ IN_FILE_NAME
OUT_FILE OUT_FILE
DS 1024,0 DS 1024,0
ALIGN 16384, 0 ALIGN 16384, 0
ENDIF

View File

@ -4,6 +4,9 @@
; https://github.com/romychs ; https://github.com/romychs
; License: BSD 3-Clause ; License: BSD 3-Clause
; ====================================================== ; ======================================================
IFNDEF _DSS_ERROR
DEFINE _DSS_ERROR
MODULE DSS_ERROR MODULE DSS_ERROR
ERR_MAX EQU 0x26 ERR_MAX EQU 0x26
@ -12,7 +15,7 @@ ERR_MAX EQU 0x26
CHECK CHECK
RET NC RET NC
PRINT EPRINT
PUSH AF PUSH AF
PRINT GET_ERR_MSG.MSG_DSS_ERROR PRINT GET_ERR_MSG.MSG_DSS_ERROR
POP AF POP AF
@ -47,46 +50,46 @@ GET_ERR_MSG
RET RET
.MSG_DSS_ERROR .MSG_DSS_ERROR
DB " Error: "Z DB " Error: ",0
.MSG_E01 DB "Invalid function"Z .MSG_E01 DB "Invalid function",0
.MSG_E02 DB "Invalid drive number"Z .MSG_E02 DB "Invalid drive number",0
.MSG_E03 DB "File not found"Z .MSG_E03 DB "File not found",0
.MSG_E04 DB "Path not found"Z .MSG_E04 DB "Path not found",0
.MSG_E05 DB "Invalid handle"Z .MSG_E05 DB "Invalid handle",0
.MSG_E06 DB "Too many open files"Z .MSG_E06 DB "Too many open files",0
.MSG_E07 DB "File exist"Z .MSG_E07 DB "File exist",0
.MSG_E08 DB "File read only"Z .MSG_E08 DB "File read only",0
.MSG_E09 DB "Root overflow"Z .MSG_E09 DB "Root overflow",0
.MSG_E0A DB "No free space"Z .MSG_E0A DB "No free space",0
.MSG_E0B DB "Directory not empty"Z .MSG_E0B DB "Directory not empty",0
.MSG_E0C DB "Attempt to remove current directory"Z .MSG_E0C DB "Attempt to remove current directory",0
.MSG_E0D DB "Invalid media"Z .MSG_E0D DB "Invalid media",0
.MSG_E0E DB "Invalid operation"Z .MSG_E0E DB "Invalid operation",0
.MSG_E0F DB "Directory exist"Z .MSG_E0F DB "Directory exist",0
.MSG_E10 DB "Invalid filename"Z .MSG_E10 DB "Invalid filename",0
.MSG_E11 DB "Invalid EXE-file"Z .MSG_E11 DB "Invalid EXE-file",0
.MSG_E12 DB "Not supported EXE-file"Z .MSG_E12 DB "Not supported EXE-file",0
.MSG_E13 DB "Permission denied"Z .MSG_E13 DB "Permission denied",0
.MSG_E14 DB "Not ready"Z .MSG_E14 DB "Not ready",0
.MSG_E15 DB "Seek error"Z .MSG_E15 DB "Seek error",0
.MSG_E16 DB "Sector not found"Z .MSG_E16 DB "Sector not found",0
.MSG_E17 DB "CRC error"Z .MSG_E17 DB "CRC error",0
.MSG_E18 DB "Write protect"Z .MSG_E18 DB "Write protect",0
.MSG_E19 DB "Read error"Z .MSG_E19 DB "Read error",0
.MSG_E1A DB "Write error"Z .MSG_E1A DB "Write error",0
.MSG_E1B DB "Drive failure"Z .MSG_E1B DB "Drive failure",0
.MSG_E1C DB "Unknown error: 28"Z .MSG_E1C DB "Unknown error: 28",0
.MSG_E1D DB "Unknown error: 29"Z .MSG_E1D DB "Unknown error: 29",0
.MSG_E1E DB "No free memory"Z .MSG_E1E DB "No free memory",0
.MSG_E1F DB "Invalid memory block"Z .MSG_E1F DB "Invalid memory block",0
.MSG_E20 DB "Unknown error: 32"Z .MSG_E20 DB "Unknown error: 32",0
.MSG_E21 DB "Extended error: 33"Z .MSG_E21 DB "Extended error: 33",0
.MSG_E22 DB "Extended error: 34"Z .MSG_E22 DB "Extended error: 34",0
.MSG_E23 DB "Too many files"Z .MSG_E23 DB "Too many files",0
.MSG_E24 DB "Too many or too nested folders (>1024)"Z .MSG_E24 DB "Too many or too nested folders (>1024)",0
.MSG_E25 DB "User abort"Z .MSG_E25 DB "User abort",0
.MSG_E26 DB "Unknown error"Z .MSG_E26 DB "Unknown error",0
.ERR_OFFSETS .ERR_OFFSETS
DW .MSG_E01,.MSG_E02,.MSG_E03,.MSG_E04,.MSG_E05,.MSG_E06,.MSG_E07,.MSG_E08 DW .MSG_E01,.MSG_E02,.MSG_E03,.MSG_E04,.MSG_E05,.MSG_E06,.MSG_E07,.MSG_E08
@ -96,4 +99,5 @@ GET_ERR_MSG
DW .MSG_E21,.MSG_E22,.MSG_E23,.MSG_E24,.MSG_E25,.MSG_E26 DW .MSG_E21,.MSG_E22,.MSG_E23,.MSG_E24,.MSG_E25,.MSG_E26
ENDMODULE ENDMODULE
ENDIF

View File

@ -5,6 +5,9 @@
; License: BSD 3-Clause ; License: BSD 3-Clause
; ====================================================== ; ======================================================
IFNDEF _ESP_LIB
DEFINE _ESP_LIB
INCLUDE "isa.asm" INCLUDE "isa.asm"
INCLUDE "util.asm" INCLUDE "util.asm"
@ -132,8 +135,9 @@ UT_T_SLOT
CALL CHK_SCR CALL CHK_SCR
RET NZ RET NZ
LD DE,0xAAAA LD DE,0xAAAA
CALL CHK_SCR JP CHK_SCR
RET ;CALL CHK_SCR
;RET
CHK_SCR CHK_SCR
LD HL, REG_SCR LD HL, REG_SCR
@ -152,20 +156,16 @@ UART_INIT
CALL ISA.ISA_OPEN CALL ISA.ISA_OPEN
LD IX, PORT_UART_A LD IX, PORT_UART_A
LD A, FCR_TR8 | FCR_FIFO ; Enable FIFO buffer, trigger to 14 byte LD (IX+_FCR),FCR_TR8 | FCR_FIFO ; Enable FIFO buffer, trigger to 14 byte
LD (IX+_FCR),A
XOR A XOR A
LD (IX+_IER), A ; Disable interrupts LD (IX+_IER), A ; Disable interrupts
; Set 8bit word and Divisor for speed ; Set 8bit word and Divisor for speed
LD A, LCR_DLAB | LCR_WL8 LD (IX+_LCR), LCR_DLAB | LCR_WL8 ; Enable Baud rate latch
LD (IX+_LCR), A ; Enable Baud rate latch LD (IX+_DLL), DIVISOR ; 8 - 115200
LD A, DIVISOR
LD (IX+_DLL), A ; 8 - 115200
XOR A XOR A
LD (IX+_DLM), A LD (IX+_DLM), A
LD A, LCR_WL8 ; 8bit word, disable latch LD (IX+_LCR), LCR_WL8 ; 8bit word, disable latch
LD (IX+_LCR), A
CALL ISA.ISA_CLOSE CALL ISA.ISA_CLOSE
POP IX,AF POP IX,AF
@ -181,8 +181,9 @@ UART_INIT
UART_READ UART_READ
CALL ISA.ISA_OPEN CALL ISA.ISA_OPEN
LD A, (HL) LD A, (HL)
CALL ISA.ISA_CLOSE JP ISA.ISA_CLOSE
RET ;CALL ISA.ISA_CLOSE
;RET
;ENDIF ;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Write TL16C550 register ; Write TL16C550 register
@ -192,8 +193,9 @@ UART_READ
UART_WRITE UART_WRITE
CALL ISA.ISA_OPEN CALL ISA.ISA_OPEN
LD (HL), E LD (HL), E
CALL ISA.ISA_CLOSE JP ISA.ISA_CLOSE
RET ;CALL ISA.ISA_CLOSE
;RET
;ENDIF ;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Wait for transmitter ready ; Wait for transmitter ready
@ -203,8 +205,9 @@ UART_WRITE
UART_WAIT_TR UART_WAIT_TR
CALL ISA.ISA_OPEN CALL ISA.ISA_OPEN
CALL UART_WAIT_TR_INT CALL UART_WAIT_TR_INT
CALL ISA.ISA_CLOSE JP ISA.ISA_CLOSE
RET ;CALL ISA.ISA_CLOSE
;RET
;ENDIF ;ENDIF
; ;
; Wait, without open/close ISA ; Wait, without open/close ISA
@ -333,7 +336,8 @@ UART_EMPTY_RS
; ------------------------------------------------------ ; ------------------------------------------------------
UART_WAIT_RS1 UART_WAIT_RS1
PUSH BC,HL PUSH BC,HL
WAIT_MS+* LD BC,0x2000 WAIT_MS EQU $+1
LD BC,0x2000
JR UVR_NEXT JR UVR_NEXT
UART_WAIT_RS UART_WAIT_RS
PUSH BC,HL PUSH BC,HL
@ -507,4 +511,6 @@ MSG_FAIL DB "FAIL", 0
RS_BUFF RS_BUFF
;DS RS_BUFF_SIZE, 0 ;DS RS_BUFF_SIZE, 0
ENDMODULE ENDMODULE
END

View File

@ -40,7 +40,7 @@ DEFAULT_TIMEOUT EQU 2000
; ------------------------------------------------------ ; ------------------------------------------------------
EXE_HEADER EXE_HEADER
DB "EXE" DB "EXE"
DB EXE_VERSION ; EXE Version DB EXE_VERSION util.asm(418) ; EXE Version
DW 0x0080 ; Code offset DW 0x0080 ; Code offset
DW 0 DW 0
DW 0 ; Primary loader size DW 0 ; Primary loader size
@ -163,7 +163,7 @@ SET_DHCP_MODE
PUSH BC,DE PUSH BC,DE
LD DE, WIFI.RS_BUFF LD DE, WIFI.RS_BUFF
LD BC, DEFAULT_TIMEOUT LD BC, DEFAULT_TIMEOUT
TRACELN MSG_SET_DHCP TRACELN MSG_SET_DHCPutil.asm(418)
SEND_CMD CMD_SET_DHCP SEND_CMD CMD_SET_DHCP
POP DE,BC POP DE,BC
RET RET

View File

@ -5,8 +5,8 @@
; License: BSD 3-Clause ; License: BSD 3-Clause
; ====================================================== ; ======================================================
IFNDEF _ISA_ASM IFNDEF _ISA
DEFINE _ISA_ASM DEFINE _ISA
INCLUDE "sprinter.inc" INCLUDE "sprinter.inc"
INCLUDE "util.asm" INCLUDE "util.asm"
@ -39,8 +39,8 @@ ISA_RESET
XOR A XOR A
OUT (C), A ; RESET=0 AEN=0 OUT (C), A ; RESET=0 AEN=0
LD HL,100 LD HL,100
CALL @UTIL.DELAY JP @UTIL.DELAY
RET ;RET
; ------------------------------------------------------ ; ------------------------------------------------------
; Open access to ISA ports as memory ; Open access to ISA ports as memory
@ -54,7 +54,8 @@ ISA_OPEN
LD BC, PORT_SYSTEM LD BC, PORT_SYSTEM
LD A, 0x11 LD A, 0x11
OUT (C), A OUT (C), A
ISA_SLOT+* LD A,0x00 ISA_SLOT EQU $+1
LD A,0x00
SLA A SLA A
OR A, 0xD4 ; D4 - ISA1, D6 - ISA2 OR A, 0xD4 ; D4 - ISA1, D6 - ISA2
LD BC, PAGE3 LD BC, PAGE3

View File

@ -62,7 +62,8 @@
; If current work mode is upload, go to label ; If current work mode is upload, go to label
MACRO IF_UPLOAD_GO lbl MACRO IF_UPLOAD_GO lbl
LD A,(WORK_MODE) LD A,(WORK_MODE)
CP WM_UPLOAD ;CP WM_UPLOAD
DEC A
JR Z,lbl JR Z,lbl
ENDM ENDM

View File

@ -29,24 +29,24 @@ OP_ERROR EQU '50'
BUILD_RRQ_PACKET 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 DE POP DE
RET RET
; ------------------------------------------------------ ; ------------------------------------------------------
; Build packet for write file to TFTF-server ; Build packet for write file to TFTF-server
; ------------------------------------------------------ ; ------------------------------------------------------
!BUILD_WRQ_PACKET BUILD_WRQ_PACKET
PUSH DE PUSH DE
LD DE,OP_WRQ ; opcode LD DE,OP_WRQ ; opcode
CALL .BUILD_RW_PACKET CALL BUILD_RW_PACKET
POP 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
LD (HL), DE LD (HL), DE
INC HL INC HL
@ -72,7 +72,7 @@ BUILD_RRQ_PACKET
LD (HL),DE LD (HL),DE
INC HL INC HL
INC HL INC HL
LD DE,'t' LD D, 0 ; DE = "/0t"
LD (HL),DE LD (HL),DE
INC HL INC HL
INC HL INC HL
@ -145,14 +145,14 @@ CHK_ERROR
; Defined TFTP Protocol Error messages ; Defined TFTP Protocol Error messages
; ------------------------------------------------------ ; ------------------------------------------------------
;MSG_TFTPE_0 DB "Not defined, see error message (if any)."Z ;MSG_TFTPE_0 DB "Not defined, see error message (if any).",0
.MSG_TFTPE_1 DB "File not found."Z .MSG_TFTPE_1 DB "File not found.",0
.MSG_TFTPE_2 DB "Access violation."Z .MSG_TFTPE_2 DB "Access violation.",0
.MSG_TFTPE_3 DB "Disk full or allocation exceeded."Z .MSG_TFTPE_3 DB "Disk full or allocation exceeded.",0
.MSG_TFTPE_4 DB "Illegal TFTP operation."Z .MSG_TFTPE_4 DB "Illegal TFTP operation.",0
.MSG_TFTPE_5 DB "Unknown transfer ID."Z .MSG_TFTPE_5 DB "Unknown transfer ID.",0
.MSG_TFTPE_6 DB "File already exists."Z .MSG_TFTPE_6 DB "File already exists.",0
.MSG_TFTPE_7 DB "No such user."Z .MSG_TFTPE_7 DB "No such user.",0
; Table with error messages offsets ; Table with error messages offsets
.TFTPE_T .TFTPE_T
@ -160,10 +160,10 @@ CHK_ERROR
DW .MSG_TFTPE_4,.MSG_TFTPE_5,.MSG_TFTPE_7,.MSG_TFTPE_7 DW .MSG_TFTPE_4,.MSG_TFTPE_5,.MSG_TFTPE_7,.MSG_TFTPE_7
.MSG_TFTP_ERR .MSG_TFTP_ERR
DB "Protocol error: "Z DB "Protocol error: ",0
.MSG_ERR_UPT .MSG_ERR_UPT
DB "Unknown TFTP packet received!"Z DB "Unknown TFTP packet received!",0
; Buffer for UDP datagram with TFTP payload ; Buffer for UDP datagram with TFTP payload
TFTF_PACKET_LEN TFTF_PACKET_LEN

View File

@ -5,10 +5,12 @@
; License: BSD 3-Clause ; License: BSD 3-Clause
; ====================================================== ; ======================================================
IFNDEF _UTIL_ASM IFNDEF _UTIL
DEFINE _UTIL_ASM DEFINE _UTIL
MODULE UTIL MODULE UTIL
include "dss_error.asm"
; ------------------------------------------------------ ; ------------------------------------------------------
; Small delay ; Small delay
@ -65,14 +67,14 @@ DELAY_100uS
; Inp: HL - pointer to string ; Inp: HL - pointer to string
; Out: BC - length of string ; Out: BC - length of string
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED STRLEN ;;IFUSED STRLEN
STRLEN STRLEN
PUSH DE,HL,HL PUSH DE,HL,HL
LD BC,MAX_BUFF_SIZE LD BC,MAX_BUFF_SIZE
XOR A XOR A
CPIR CPIR
POP DE POP DE
SUB HL,DE ; llength of zero ended string SBC HL,DE ; length of zero ended string
LD BC,HL LD BC,HL
LD A, B LD A, B
OR C OR C
@ -81,14 +83,14 @@ STRLEN
.STRL_NCOR .STRL_NCOR
POP HL,DE POP HL,DE
RET RET
ENDIF ;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Compare strings ; Compare strings
; Inp: HL, DE - pointers to asciiz strings to compare ; Inp: HL, DE - pointers to asciiz strings to compare
; Out: CF=0 - equal, CF=1 - not equal ; Out: CF=0 - equal, CF=1 - not equal
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED STRCMP ;;IFUSED STRCMP
STRCMP STRCMP
PUSH DE,HL PUSH DE,HL
.STC_NEXT .STC_NEXT
@ -105,7 +107,7 @@ STRCMP
.STC_EQ .STC_EQ
POP HL,DE POP HL,DE
RET RET
ENDIF ;;ENDIF
@ -115,7 +117,7 @@ STRCMP
; BC - Number of chars to compare ; BC - Number of chars to compare
; Out: ZF=0 - not equal, ZF=1 - equal ; Out: ZF=0 - not equal, ZF=1 - equal
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED STRNCMP ;IFUSED STRNCMP
STRNCMP STRNCMP
PUSH HL,DE,BC PUSH HL,DE,BC
.STRN_NXT .STRN_NXT
@ -134,7 +136,7 @@ STRNCMP
.STRN_NE .STRN_NE
POP BC,DE,HL POP BC,DE,HL
RET RET
ENDIF ;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Checks whether a string (HL) starts with the strinf (DE) ; Checks whether a string (HL) starts with the strinf (DE)
@ -142,7 +144,7 @@ STRNCMP
; HL - points to string ; HL - points to string
; Out: ZF=0 - not equal, ZF=1 - equal ; Out: ZF=0 - not equal, ZF=1 - equal
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED STARTSWITH ;;IFUSED STARTSWITH
STARTSWITH STARTSWITH
PUSH HL,DE PUSH HL,DE
.STRW_NXT .STRW_NXT
@ -158,7 +160,7 @@ STARTSWITH
.STRW_END .STRW_END
POP DE,HL POP DE,HL
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
@ -166,7 +168,7 @@ STARTSWITH
; Inp: HL - pointer to string ; Inp: HL - pointer to string
; Out: HL - points to first non space symbol ; Out: HL - points to first non space symbol
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED LTRIM ;;IFUSED LTRIM
LTRIM LTRIM
LD A, (HL) LD A, (HL)
OR A OR A
@ -175,14 +177,14 @@ LTRIM
RET P RET P
INC HL INC HL
JR LTRIM JR LTRIM
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Convert string to number ; Convert string to number
; Inp: DE - ptr to zero ended string ; Inp: DE - ptr to zero ended string
; Out: HL - Result ; Out: HL - Result
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED ATOU ;;IFUSED ATOU
ATOU ATOU
PUSH BC PUSH BC
LD HL,0x0000 LD HL,0x0000
@ -208,7 +210,7 @@ ATOU
.ATOU_LE .ATOU_LE
POP BC POP BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Convert 16 bit unsigned number to string ; Convert 16 bit unsigned number to string
@ -216,7 +218,7 @@ ATOU
; DE - ptr to buffer ; DE - ptr to buffer
; Out: DE -> asciiz string representing a number ; Out: DE -> asciiz string representing a number
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED UTOA ;;IFUSED UTOA
UTOA: UTOA:
PUSH BC, HL PUSH BC, HL
XOR A XOR A
@ -263,7 +265,7 @@ DIV_10:
DJNZ .DDL1 DJNZ .DDL1
POP BC POP BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; FAST_UTOA ; FAST_UTOA
; Inp: HL - number ; Inp: HL - number
@ -271,7 +273,7 @@ DIV_10:
; CF is set to write leading zeroes ; CF is set to write leading zeroes
; Out: DE - address of strinf ; Out: DE - address of strinf
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED FAST_UTOA ;;IFUSED FAST_UTOA
FAST_UTOA FAST_UTOA
LD BC,0+256 LD BC,0+256
PUSH BC PUSH BC
@ -343,7 +345,7 @@ FAST_UTOA
INC DE INC DE
JR .LEADING_ZEROES JR .LEADING_ZEROES
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Find char in string ; Find char in string
@ -352,7 +354,7 @@ FAST_UTOA
; Outp: CF=0, HL points to char if found ; Outp: CF=0, HL points to char if found
; CF=1 - Not found ; CF=1 - Not found
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED STRCHR ;;IFUSED STRCHR
STRCHR STRCHR
PUSH BC PUSH BC
.STCH_NEXT .STCH_NEXT
@ -363,20 +365,20 @@ STRCHR
CP C CP C
JR Z, .STCH_FOUND JR Z, .STCH_FOUND
INC HL INC HL
JR STCH_NEXT JR .STCH_NEXT
.STCH_N_FOUND .STCH_N_FOUND
SCF SCF
.STCH_FOUND .STCH_FOUND
POP BC POP BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Convert Byte to hex ; Convert Byte to hex
; Inp: C ; Inp: C
; Out: (DE) ; Out: (DE)
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED HEXB ;;IFUSED HEXB
HEXB HEXB
LD A,C LD A,C
RRA RRA
@ -395,7 +397,7 @@ HEXB
LD (DE), A LD (DE), A
INC DE INC DE
RET RET
ENDIF ;;ENDIF
; ---------------------------------------------------- ; ----------------------------------------------------
@ -407,7 +409,7 @@ GET_CUR_DIR
PUSH HL PUSH HL
LD C, DSS_CURDISK LD C, DSS_CURDISK
RST DSS RST DSS
CALL DSS_ERROR.CHECK CALL @DSS_ERROR.CHECK
ADD A, 65 ADD A, 65
LD (HL),A LD (HL),A
INC HL INC HL
@ -415,10 +417,10 @@ GET_CUR_DIR
INC HL INC HL
LD C, DSS_CURDIR LD C, DSS_CURDIR
RST DSS RST DSS
CALL DSS_ERROR.CHECK CALL @DSS_ERROR.CHECK
POP HL POP HL
CALL ADD_BACK_SLASH JP ADD_BACK_SLASH
RET ;RET
; ---------------------------------------------------- ; ----------------------------------------------------
; Add back slash to path string ; Add back slash to path string

View File

@ -1,81 +0,0 @@
; ------------------------------------------------------
; FAST_UTOA
; Inp: HL - number
; A - Radix 2,8,10,16
; DE - Buffer
; CF is set to write leading zeroes
; Out: DE - address of strinf
; ------------------------------------------------------
FAST_UTOA
LD BC,0+256
PUSH BC
LD BC,-10+256
PUSH BC
INC H
DEC H
JR Z, .EIGHT_BIT
LD C,0XFF & (-100+256)
PUSH BC
LD BC,-1000+256
PUSH BC
LD BC,-10000
JR C,.LEADING_ZEROES
.NO_LEADING_ZEROES
CALL .DIVIDE
CP '0'
JR NZ,.WRITE
POP BC
DJNZ .NO_LEADING_ZEROES
JR .WRITE1S
.LEADING_ZEROES
CALL .DIVIDE
.WRITE
LD (DE),A
INC DE
POP BC
DJNZ .LEADING_ZEROES
.WRITE1S
LD A,L
ADD A,'0'
LD (DE),A
INC DE
RET
.DIVIDE
LD A,'0'-1
.DIVLOOP
INC A
ADD HL,BC
JR C, .DIVLOOP
SBC HL,BC
RET
.EIGHT_BIT
LD BC,-100
JR NC, .NO_LEADING_ZEROES
; write two leading zeroes to output string
LD A,'0'
LD (DE),A
INC DE
LD (DE),A
INC DE
JR .LEADING_ZEROES

View File

@ -4,6 +4,10 @@
; https://github.com/romychs ; https://github.com/romychs
; License: BSD 3-Clause ; License: BSD 3-Clause
; ====================================================== ; ======================================================
IFNDEF _WCOMMON
DEFINE _WCOMMON
ENABLE_RTS_CTR EQU 1 ENABLE_RTS_CTR EQU 1
@ -12,7 +16,7 @@ ENABLE_RTS_CTR EQU 1
; ------------------------------------------------------ ; ------------------------------------------------------
; Ckeck for error (CF=1) print message and exit ; Ckeck for error (CF=1) print message and exit
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED CHECK_ERROR ;;IFUSED CHECK_ERROR
CHECK_ERROR CHECK_ERROR
RET NC RET NC
ADD A,'0' ADD A,'0'
@ -21,7 +25,7 @@ CHECK_ERROR
CALL DUMP_UART_REGS CALL DUMP_UART_REGS
LD B,3 LD B,3
POP HL ; ret addr reset POP HL ; ret addr reset
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Program exit point ; Program exit point
@ -32,7 +36,7 @@ EXIT
; ------------------------------------------------------ ; ------------------------------------------------------
; Search Sprinter WiFi card ; Search Sprinter WiFi card
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED FIND_SWF ;;IFUSED FIND_SWF
FIND_SWF FIND_SWF
; Find Sprinter-WiFi ; Find Sprinter-WiFi
CALL @WIFI.UART_FIND CALL @WIFI.UART_FIND
@ -48,12 +52,12 @@ NO_TL_FOUND
PRINTLN MSG_SWF_NOF PRINTLN MSG_SWF_NOF
LD B,2 LD B,2
JP EXIT JP EXIT
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Dump all UTL16C550 registers to screen for debug ; Dump all UTL16C550 registers to screen for debug
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED DUMP_UART_REGS ;;IFUSED DUMP_UART_REGS
IFDEF TRACE IFDEF TRACE
DUMP_UART_REGS DUMP_UART_REGS
; Dump, DLAB=0 registers ; Dump, DLAB=0 registers
@ -70,8 +74,9 @@ DUMP_UART_REGS
LD HL, REG_LCR LD HL, REG_LCR
LD E, LCR_WL8 LD E, LCR_WL8
CALL WIFI.UART_WRITE JP WIFI.UART_WRITE
RET ;CALL WIFI.UART_WRITE
;RET
DUMP_REGS DUMP_REGS
LD HL, PORT_UART_A LD HL, PORT_UART_A
@ -95,12 +100,12 @@ DR_NEXT
DJNZ DR_NEXT DJNZ DR_NEXT
RET RET
ENDIF ENDIF
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Store old video mode, set 80x32 and clear ; Store old video mode, set 80x32 and clear
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED INIT_VMODE ;;IFUSED INIT_VMODE
INIT_VMODE INIT_VMODE
PUSH BC,DE,HL PUSH BC,DE,HL
; Store previous vmode ; Store previous vmode
@ -116,19 +121,18 @@ INIT_VMODE
IVM_ALRDY_80 IVM_ALRDY_80
; Clear screen ; Clear screen
LD A,' ' LD A,' '
LD B,0x07 LD BC,0x0700 + DSS_CLEAR
LD C,DSS_CLEAR
LD HL,0x2050 LD HL,0x2050
LD DE,0x0000 LD DE,0x0000
RST DSS RST DSS
POP HL,DE,BC POP HL,DE,BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Restore saved video mode ; Restore saved video mode
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED REST_VMODE ;;IFUSED REST_VMODE
REST_VMODE REST_VMODE
PUSH BC PUSH BC
LD A,(SAVE_VMODE) LD A,(SAVE_VMODE)
@ -145,12 +149,12 @@ REST_VMODE
RVM_SAME RVM_SAME
POP BC POP BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Init basic parameters of ESP ; Init basic parameters of ESP
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED INIT_ESP ;;IFUSED INIT_ESP
INIT_ESP INIT_ESP
PUSH BC, DE PUSH BC, DE
LD DE, @WIFI.RS_BUFF LD DE, @WIFI.RS_BUFF
@ -174,12 +178,12 @@ INIT_ESP
SEND_CMD CMD_CWLAP_OPT SEND_CMD CMD_CWLAP_OPT
POP DE,BC POP DE,BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Set DHCP mode ; Set DHCP mode
; Out: CF=1 if error ; Out: CF=1 if error
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED SET_DHCP_MODE ;;IFUSED SET_DHCP_MODE
SET_DHCP_MODE SET_DHCP_MODE
PUSH BC,DE PUSH BC,DE
LD DE, WIFI.RS_BUFF LD DE, WIFI.RS_BUFF
@ -188,19 +192,19 @@ SET_DHCP_MODE
SEND_CMD CMD_SET_DHCP SEND_CMD CMD_SET_DHCP
POP DE,BC POP DE,BC
RET RET
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Messages ; Messages
; ------------------------------------------------------ ; ------------------------------------------------------
IFUSED FIND_SWF ;;IFUSED FIND_SWF
MSG_SWF_NOF MSG_SWF_NOF
DB "Sprinter-WiFi not found!",0 DB "Sprinter-WiFi not found!",0
MSG_SWF_FOUND MSG_SWF_FOUND
DB "Sprinter-WiFi found in ISA#" DB "Sprinter-WiFi found in ISA#"
MSG_SLOT_NO MSG_SLOT_NO
DB "n slot.",0 DB "n slot.",0
ENDIF ;;ENDIF
MSG_COMM_ERROR MSG_COMM_ERROR
DB "Error communication with Sprinter-WiFi #" DB "Error communication with Sprinter-WiFi #"
@ -220,10 +224,10 @@ MSG_UART_INIT
LINE_END LINE_END
DB "\r\n",0 DB "\r\n",0
IFUSED INIT_VMODE ;;IFUSED INIT_VMODE
SAVE_VMODE SAVE_VMODE
DB 0 DB 0
ENDIF ;;ENDIF
; ------------------------------------------------------ ; ------------------------------------------------------
; Debug messages ; Debug messages
@ -286,4 +290,6 @@ CMD_GET_IP
DB "AT+CIPSTA?\r\n",0 DB "AT+CIPSTA?\r\n",0
ENDMODULE ENDMODULE
ENDIF

View File

@ -10,7 +10,7 @@
;DEFINE EQU 0 ;DEFINE EQU 0
; Define to output TRACE messages ; Define to output TRACE messages
DEFINE TRACE DEFINE TRACE
; Version of EXE file, 1 for DSS 1.70+ ; Version of EXE file, 1 for DSS 1.70+
@ -19,11 +19,9 @@ EXE_VERSION EQU 1
; Timeout to wait ESP response ; Timeout to wait ESP response
DEFAULT_TIMEOUT EQU 2000 DEFAULT_TIMEOUT EQU 2000
DEFDEVICE SPRINTER, 0x4000, 256, 0,1,2,3 ;DEFDEVICE SPRINTER, 0x4000, 256, 0,1,2,3
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE NOSLOT64K
DEVICE SPRINTER ;NOSLOT64K
IFDEF DEBUG IFDEF DEBUG
INCLUDE "dss.asm" INCLUDE "dss.asm"
@ -205,27 +203,27 @@ OK_EXIT
; ------------------------------------------------------ ; ------------------------------------------------------
MSG_START MSG_START
DB "Terminal for Sprinter-WiFi by Sprinter Team. v1.0 beta3, ", __DATE__, "\r\n"Z DB "Terminal for Sprinter-WiFi by Sprinter Team. v1.0 beta3, ", __DATE__, "\r\n",0
MSG_HLP MSG_HLP
DB"\r\nEnter ESP AT command or Alt+x to close terminal."Z DB"\r\nEnter ESP AT command or Alt+x to close terminal.",0
MSG_EXIT MSG_EXIT
MSG_TX_ERROR MSG_TX_ERROR
DB "Transmitter not ready"Z DB "Transmitter not ready",0
MSG_RX_ERROR MSG_RX_ERROR
DB "Receiver error LSR: 0x" DB "Receiver error LSR: 0x"
MSG_LSR_VALUE MSG_LSR_VALUE
DB "xx"Z DB "xx",0
MSG_MANY_RX_ERROR MSG_MANY_RX_ERROR
DB "Too many receiver errors!"Z DB "Too many receiver errors!",0
MSG_ALT MSG_ALT
DB "Pressed ALT+" DB "Pressed ALT+"
MSG_ALT_KEY MSG_ALT_KEY
DB "xx"Z DB "xx",0
; TX_DATA ; TX_DATA
; DB " ",0 ; DB " ",0
@ -233,21 +231,22 @@ MSG_ALT_KEY
; Custom commands ; Custom commands
; ------------------------------------------------------ ; ------------------------------------------------------
CMD_QUIT CMD_QUIT
DB "QUIT\r"Z DB "QUIT\r",0
RX_ERR RX_ERR
DB 0 DB 0
IFDEF DEBUG IFDEF DEBUG
CMD_TEST1 DB "ATE0\r\n"Z CMD_TEST1 DB "ATE0\r\n",0
BUFF_TEST1 DS RS_BUFF_SIZE,0 BUFF_TEST1 DS RS_BUFF_SIZE,0
ENDIF ENDIF
ENDMODULE ENDMODULE
INCLUDE "wcommon.asm" INCLUDE "wcommon.asm"
INCLUDE "dss_error.asm"
;INCLUDE "util.asm" ;INCLUDE "util.asm"
INCLUDE "isa.asm" INCLUDE "isa.asm"
INCLUDE "esplib.asm" INCLUDE "esplib.asm"
END MAIN.START END ;MAIN.START

View File

@ -85,8 +85,8 @@ DONE
CALL CLOSE_LOCAL_FILE CALL CLOSE_LOCAL_FILE
;IFDEF DEBUG ;IFDEF DEBUG
LD B,0 LD BC, DSS_EXIT
DSS_EXEC DSS_EXIT RST DSS
;ENDIF ;ENDIF
@ -147,8 +147,9 @@ PARSE_CMD_LINE
; handle lfn ; handle lfn
CALL GET_LFN CALL GET_LFN
CALL COPY_LFN JP COPY_LFN
RET ;CALL COPY_LFN
;RET
.PLC_UPLOAD .PLC_UPLOAD
; Work mode "Upload" ; Work mode "Upload"
@ -162,9 +163,9 @@ PARSE_CMD_LINE
CALL @UTIL.STARTSWITH CALL @UTIL.STARTSWITH
JR NZ,OUT_USAGE_MSG JR NZ,OUT_USAGE_MSG
CALL GET_SRV_PARAMS JP GET_SRV_PARAMS
;CALL GET_SRV_PARAMS
RET ;RET
; ------------------------------------------------------ ; ------------------------------------------------------
OUT_ERR_CMD_MSG OUT_ERR_CMD_MSG
@ -339,7 +340,7 @@ OPEN_LOCAL_FILE
OR A OR A
JR NZ,.OLF_SKP_CP JR NZ,.OLF_SKP_CP
LD HL, @TMP_BUFF LD HL, TMP_BUFF
CALL UTIL.GET_CUR_DIR CALL UTIL.GET_CUR_DIR
LD DE,LOC_FILE LD DE,LOC_FILE
LD B,128 LD B,128
@ -352,7 +353,7 @@ OPEN_LOCAL_FILE
INC DE INC DE
DJNZ .OLF_NXT DJNZ .OLF_NXT
.OLF_EFN .OLF_EFN
LD HL, @TMP_BUFF LD HL, TMP_BUFF
; HL - points to file path name ; HL - points to file path name
.OLF_SKP_CP .OLF_SKP_CP
@ -372,7 +373,7 @@ OPEN_LOCAL_FILE
POP HL POP HL
JR NC,.OLF_END JR NC,.OLF_END
CP 0x07 ; file exists? CP 0x07 ; file exists?
JP NZ,DSS_ERROR.PRINT ; print error and exit JP NZ,DSS_ERROR.EPRINT ; print error and exit
PUSH HL PUSH HL
PRINTLN MSG_OF_EXISTS PRINTLN MSG_OF_EXISTS
POP HL POP HL
@ -405,15 +406,15 @@ PRINT_FILENAME
MSG_OF_EXISTS MSG_OF_EXISTS
DB "Output file already exists!"Z DB "Output file already exists!",0
IFDEF TRACE IFDEF TRACE
MSG_LFN_CR MSG_LFN_CR
DB "Create file: "Z DB "Create file: ",0
MSG_LFN_OP MSG_LFN_OP
DB "Open file: "Z DB "Open file: ",0
MSG_LFN_OPEN MSG_LFN_OPEN
DB "File successfully accessed."Z DB "File successfully accessed.",0
ENDIF ENDIF
@ -425,8 +426,9 @@ CLOSE_LOCAL_FILE
OR A OR A
RET Z RET Z
DSS_EXEC DSS_CLOSE_FILE DSS_EXEC DSS_CLOSE_FILE
CALL DSS_ERROR.CHECK JP DSS_ERROR.CHECK
RET ;CALL DSS_ERROR.CHECK
;RET
; ------------------------------------------------------ ; ------------------------------------------------------
; Display current working mode ; Display current working mode
@ -456,48 +458,48 @@ DISPLAY_MODE
; ------------------------------------------------------ ; ------------------------------------------------------
MSG_START MSG_START
DB "TFTP client for Sprinter-WiFi by Sprinter Team. v1.0 beta1, ", __DATE__, "\r\n"Z DB "TFTP client for Sprinter-WiFi by Sprinter Team. v1.0 beta1, ", __DATE__, "\r\n",0
MSG_ERR_CMD MSG_ERR_CMD
DB "Invalid command line parameters!\r\n"Z DB "Invalid command line parameters!\r\n",0
MSG_HLP MSG_HLP
DB "\r\nUse:\r\n wtftp.exe tftp://server[:port]/filename filename - to download from server;\r\n" DB "\r\nUse:\r\n wtftp.exe tftp://server[:port]/filename filename - to download from server;\r\n"
DB " wtftp.exe filename tftp://server[:port]/filename - to upload to server.\r\n"Z DB " wtftp.exe filename tftp://server[:port]/filename - to upload to server.\r\n",0
MSG_TX_ERROR MSG_TX_ERROR
DB "Transmitter not ready"Z DB "Transmitter not ready",0
MSG_RX_ERROR MSG_RX_ERROR
DB "Receiver error LSR: 0x" DB "Receiver error LSR: 0x"
MSG_LSR_VALUE MSG_LSR_VALUE
DB "xx"Z DB "xx",0
MSG_MANY_RX_ERROR MSG_MANY_RX_ERROR
DB "Too many receiver errors!"Z DB "Too many receiver errors!",0
MSG_ERR_PORT MSG_ERR_PORT
DB "Invalid UDP port in URL, will be number 1..65535"Z DB "Invalid UDP port in URL, will be number 1..65535",0
MSG_ERR_RFN MSG_ERR_RFN
DB "Remote file name not specified in URL, or too long!"Z DB "Remote file name not specified in URL, or too long!",0
MSG_ERR_LFN MSG_ERR_LFN
DB "Invalid local file name!"Z DB "Invalid local file name!",0
MSG_MODE_D MSG_MODE_D
DB "Download file "Z DB "Download file ",0
MSG_MODE_D_S MSG_MODE_D_S
DB " from server "Z DB " from server ",0
MSG_MODE_D_T MSG_MODE_D_T
DB " to file "Z DB " to file ",0
MSG_MODE_U MSG_MODE_U
DB "Upload file "Z DB "Upload file ",0
MSG_MODE_U_S MSG_MODE_U_S
DB " to server "Z DB " to server ",0
MSG_MODE_U_T MSG_MODE_U_T
DB " to file "Z DB " to file ",0
; ------------------------------------------------------ ; ------------------------------------------------------
; Variables ; Variables
@ -505,7 +507,7 @@ MSG_MODE_U_T
; Start of tftf URL ; Start of tftf URL
TFTF_START TFTF_START
DB "tftp://"Z DB "tftp://",0
; Work Mode ; Work Mode
@ -528,7 +530,7 @@ REM_FILE
LOC_FILE LOC_FILE
DS 128,0 DS 128,0
; Local file handle ; Local file handlewtftp.asm(343)
LOC_FH LOC_FH
DW 0 DW 0
@ -536,6 +538,8 @@ LOC_FH
HAVE_PATH HAVE_PATH
DB 0 DB 0
TMP_BUFF EQU WIFI.RS_BUFF + RS_BUFF_SIZE
ENDMODULE ENDMODULE
; ------------------------------------------------------ ; ------------------------------------------------------
; Includes ; Includes
@ -549,6 +553,6 @@ HAVE_PATH
INCLUDE "esplib.asm" INCLUDE "esplib.asm"
TMP_BUFF
END MAIN.START END MAIN.START