mirror of
https://github.com/romychs/SprinterESP.git
synced 2025-12-16 04:15:58 +03:00
Refactoring code for best reuse in other utilities
This commit is contained in:
parent
8d5f374035
commit
0a3eb0225e
@ -1,3 +1,9 @@
|
|||||||
|
; ======================================================
|
||||||
|
; DSS Estex dumb for debug code in VSC with DEZOG plugin
|
||||||
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
|
; https://github.com/romychs
|
||||||
|
; ======================================================
|
||||||
|
|
||||||
ORG 0x0000
|
ORG 0x0000
|
||||||
|
|
||||||
RESET:
|
RESET:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; Defines for DSS Estex for Sprinter computer
|
; Defines for DSS Estex for Sprinter computer
|
||||||
; By Romych, 2024
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
; https://github.com/romychs
|
; https://github.com/romychs
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; Library for Sprinter-WiFi ESP ISA Card
|
; Library for Sprinter-WiFi ESP ISA Card
|
||||||
;
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
; By Romych's, 2024 (c)
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
;ISA_BASE_A EQU 0xC000 ; Базовый адрес портов ISA в памяти
|
;ISA_BASE_A EQU 0xC000 ; Базовый адрес портов ISA в памяти
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
#pragma nonrec
|
|
||||||
|
|
||||||
#define port_isa 0x9FBD
|
|
||||||
#define port_system 0x1FFD
|
|
||||||
#define isa_addr_base 0xC000
|
|
||||||
#define com3_addr_base 0x3E8
|
|
||||||
#define emm_win_p3 0xE2
|
|
||||||
#define port_serial 0xC3E8
|
|
||||||
|
|
||||||
#define RBR port_serial
|
|
||||||
#define THR port_serial
|
|
||||||
#define IER port_serial+1
|
|
||||||
#define IIR port_serial+2
|
|
||||||
#define FCR port_serial+2
|
|
||||||
#define LCR port_serial+3
|
|
||||||
#define MCR port_serial+4
|
|
||||||
#define LSR port_serial+5
|
|
||||||
#define MSR port_serial+6
|
|
||||||
#define SCR port_serial+7
|
|
||||||
#define DLL port_serial
|
|
||||||
#define DLM port_serial+1
|
|
||||||
#define AFR port_serial+2
|
|
||||||
|
|
||||||
#define BAUD_RATE 115200
|
|
||||||
#define XIN_FREQ 14745600
|
|
||||||
#define DIVISOR XIN_FREQ / (BAUD_RATE * 16)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small delay
|
|
||||||
*/
|
|
||||||
void delay();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset ISA device
|
|
||||||
*/
|
|
||||||
void reset_isa();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open access to ISA ports as memory
|
|
||||||
*/
|
|
||||||
void open_isa();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close access to ISA ports
|
|
||||||
*/
|
|
||||||
void close_isa();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Init ISA device
|
|
||||||
*/
|
|
||||||
void init_isa();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Init UART device TL16C550
|
|
||||||
*/
|
|
||||||
void init_serial();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read TL16C550 register
|
|
||||||
*/
|
|
||||||
char read_reg();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write TL16C550 register
|
|
||||||
*/
|
|
||||||
void write_reg();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait for transmitter ready
|
|
||||||
*/
|
|
||||||
void wait_tr();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear receiver FIFO buffer
|
|
||||||
*/
|
|
||||||
void empty_rs();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait byte in receiver fifo
|
|
||||||
*/
|
|
||||||
void wait_rs();
|
|
||||||
|
|
||||||
@ -1,9 +1,11 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; ESPSET for SprinterWiFi for Sprinter computer
|
; ESPSET for Sprinter-WiFi for Sprinter computer
|
||||||
; By Romych, 2024
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
; https://github.com/romychs
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
|
|
||||||
; 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
|
||||||
DEBUG EQU 0
|
DEBUG EQU 0
|
||||||
@ -198,7 +200,7 @@ SMM_L1
|
|||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
MSG_START
|
MSG_START
|
||||||
DB "ESP-Setup for Sprinter-WiFi by Romych's, (c) 2024\r\n", 0
|
DB "Setup for Sprinter-WiFi by Sprinter Team, ", __DATE__ ,"\r\n", 0
|
||||||
|
|
||||||
MSG_SWF_NOF
|
MSG_SWF_NOF
|
||||||
DB "Sprinter-WiFi not found!",0
|
DB "Sprinter-WiFi not found!",0
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; ISA Library for Sprinter
|
; ISA Library for Sprinter computer
|
||||||
; By Romych's, 2024 (c)
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
PORT_ISA EQU 0x9FBD
|
PORT_ISA EQU 0x9FBD
|
||||||
@ -18,8 +20,6 @@ ISA_A19 EQU 0x20
|
|||||||
ISA_AEN EQU 0x40
|
ISA_AEN EQU 0x40
|
||||||
ISA_RST EQU 0x80
|
ISA_RST EQU 0x80
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MODULE ISA
|
MODULE ISA
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -74,33 +74,7 @@ ISA_CLOSE
|
|||||||
POP BC,AF
|
POP BC,AF
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
|
||||||
; DELAY_20
|
|
||||||
; ;IN A,(PAGE1)
|
|
||||||
; LD A, CTC_CR_VEC | CTC_CR_SWR ; stop timer
|
|
||||||
; OUT (CTC_CH1), A
|
|
||||||
; ; Init Ch2 CTC - clk source for Ch3
|
|
||||||
; LD A,CTC_CT_PRE | CTC_CR_TCF | CTC_CR_SWR | CTC_CR_VEC
|
|
||||||
; OUT (CTC_CH2), A
|
|
||||||
; LD A, 4
|
|
||||||
; ; TO2->TRG3 = 875kHz / 256 / 4 = 854,5 Hz
|
|
||||||
; OUT (CTC_CH2), A
|
|
||||||
|
|
||||||
; LD A, CTC_CT_EI | CTC_CT_CTR | CTC_CR_TCF | CTC_CR_SWR | CTC_CR_VEC
|
|
||||||
; OUT (CTC_CH3), A
|
|
||||||
; LD A, 17
|
|
||||||
; OUT (CTC_CH3), A
|
|
||||||
|
|
||||||
|
|
||||||
; it vector defined in bit 73,bit 21 don't care, bit 0 = 0
|
|
||||||
; and loaded into channel 0
|
|
||||||
|
|
||||||
; To save memory page 0
|
|
||||||
SAVE_MMU0 DB 0
|
|
||||||
; To save memory page 3
|
; To save memory page 3
|
||||||
SAVE_MMU3 DB 0
|
SAVE_MMU3 DB 0
|
||||||
|
|
||||||
; ALIGN 256,0
|
|
||||||
|
|
||||||
|
|
||||||
ENDMODULE
|
ENDMODULE
|
||||||
@ -1,15 +1,25 @@
|
|||||||
|
; ======================================================
|
||||||
|
; Macros for Sprinter-WiFi utilities
|
||||||
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
|
; ======================================================
|
||||||
|
|
||||||
|
; Transmit data|command via UART and check response
|
||||||
MACRO SEND_CMD data
|
MACRO SEND_CMD data
|
||||||
LD HL, data
|
LD HL, data
|
||||||
CALL WIFI.UART_TX_CMD
|
CALL WIFI.UART_TX_CMD
|
||||||
CALL CHECK_ERROR
|
CALL CHECK_ERROR
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
; Print data ASCIIZ string to screen
|
||||||
MACRO PRINT data
|
MACRO PRINT data
|
||||||
LD HL,data
|
LD HL,data
|
||||||
LD C,DSS_PCHARS
|
LD C,DSS_PCHARS
|
||||||
RST DSS
|
RST DSS
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
; Print data ASCIIZ string to screen and CR+LF
|
||||||
MACRO PRINTLN data
|
MACRO PRINTLN data
|
||||||
LD HL,data
|
LD HL,data
|
||||||
LD C,DSS_PCHARS
|
LD C,DSS_PCHARS
|
||||||
@ -19,6 +29,7 @@
|
|||||||
RST DSS
|
RST DSS
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
; Print data ASCIIZ string to screen if TRACE enabled
|
||||||
MACRO TRACELN data
|
MACRO TRACELN data
|
||||||
IF TRACE == 1
|
IF TRACE == 1
|
||||||
PUSH BC,DE
|
PUSH BC,DE
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; Defines for Sprinter computer hardware
|
; Defines for Sprinter computer hardware
|
||||||
; By Romych, 2024
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
; https://github.com/romychs
|
; https://github.com/romychs
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
|
; ======================================================
|
||||||
|
; Utility code for Sprinter-WiFi utilities
|
||||||
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
|
; ======================================================
|
||||||
|
|
||||||
MODULE UTIL
|
MODULE UTIL
|
||||||
|
|
||||||
@ -151,6 +156,28 @@ STCH_FOUND
|
|||||||
POP BC
|
POP BC
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
; ------------------------------------------------------
|
||||||
|
; Convert Byte to hex
|
||||||
|
; Inp: C
|
||||||
|
; Out: (DE)
|
||||||
|
; ------------------------------------------------------
|
||||||
|
HEXB
|
||||||
|
LD A,C
|
||||||
|
RRA
|
||||||
|
RRA
|
||||||
|
RRA
|
||||||
|
RRA
|
||||||
|
CALL CONV_NIBLE
|
||||||
|
LD A,C
|
||||||
|
CONV_NIBLE
|
||||||
|
AND 0x0f
|
||||||
|
ADD A,0x90
|
||||||
|
DAA
|
||||||
|
ADC A,0x40
|
||||||
|
DAA
|
||||||
|
LD (DE), A
|
||||||
|
INC DE
|
||||||
|
RET
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,10 @@
|
|||||||
|
; ======================================================
|
||||||
|
; Common code for Sprinter-WiFi utilities
|
||||||
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
|
; ======================================================
|
||||||
|
|
||||||
MODULE WCOMMON
|
MODULE WCOMMON
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -9,6 +16,7 @@ CHECK_ERROR
|
|||||||
ADD A,'0'
|
ADD A,'0'
|
||||||
LD (COMM_ERROR_NO), A
|
LD (COMM_ERROR_NO), A
|
||||||
PRINTLN MSG_COMM_ERROR
|
PRINTLN MSG_COMM_ERROR
|
||||||
|
CALL DUMP_UART_REGS
|
||||||
LD B,3
|
LD B,3
|
||||||
POP HL ; ret addr reset
|
POP HL ; ret addr reset
|
||||||
|
|
||||||
@ -37,6 +45,52 @@ NO_TL_FOUND
|
|||||||
JP EXIT
|
JP EXIT
|
||||||
|
|
||||||
|
|
||||||
|
IF TRACE
|
||||||
|
; ------------------------------------------------------
|
||||||
|
; Dump all UTL16C550 registers to screen for debug
|
||||||
|
; ------------------------------------------------------
|
||||||
|
DUMP_UART_REGS
|
||||||
|
; Dump, DLAB=0 registers
|
||||||
|
LD BC, 0x0800
|
||||||
|
CALL DUMP_REGS
|
||||||
|
|
||||||
|
; Dump, DLAB=1 registers
|
||||||
|
LD HL, REG_LCR
|
||||||
|
LD E, LCR_DLAB | LCR_WL8
|
||||||
|
CALL WIFI.UART_WRITE
|
||||||
|
|
||||||
|
LD BC, 0x0210
|
||||||
|
CALL DUMP_REGS
|
||||||
|
|
||||||
|
LD HL, REG_LCR
|
||||||
|
LD E, LCR_WL8
|
||||||
|
CALL WIFI.UART_WRITE
|
||||||
|
RET
|
||||||
|
|
||||||
|
DUMP_REGS
|
||||||
|
LD HL, PORT_UART_A
|
||||||
|
|
||||||
|
DR_NEXT
|
||||||
|
LD DE,MSG_DR_RN
|
||||||
|
CALL UTIL.HEXB
|
||||||
|
INC C
|
||||||
|
|
||||||
|
CALL WIFI.UART_READ
|
||||||
|
PUSH BC
|
||||||
|
LD C,A
|
||||||
|
LD DE,MSG_DR_RV
|
||||||
|
CALL UTIL.HEXB
|
||||||
|
PUSH HL
|
||||||
|
|
||||||
|
PRINTLN MSG_DR
|
||||||
|
|
||||||
|
POP HL,BC
|
||||||
|
INC HL
|
||||||
|
DJNZ DR_NEXT
|
||||||
|
RET
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Store old video mode, set 80x32 and clear
|
; Store old video mode, set 80x32 and clear
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -158,6 +212,13 @@ SAVE_VMODE
|
|||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
IF TRACE
|
IF TRACE
|
||||||
|
|
||||||
|
MSG_DR
|
||||||
|
DB "Reg[0x"
|
||||||
|
MSG_DR_RN
|
||||||
|
DB "vv]=0x"
|
||||||
|
MSG_DR_RV
|
||||||
|
DB "vv",0
|
||||||
|
|
||||||
MSG_ECHO_OFF
|
MSG_ECHO_OFF
|
||||||
DB "Echo off",0
|
DB "Echo off",0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
; ======================================================
|
; ======================================================
|
||||||
; WTERM for SprinterWiFi for Sprinter computer
|
; WTERM terminal for Sprinter-WiFi ISA Card
|
||||||
; By Romych, 2024
|
; For Sprinter computer DSS
|
||||||
|
; By Roman Boykov. Copyright (c) 2024
|
||||||
; https://github.com/romychs
|
; https://github.com/romychs
|
||||||
|
; License: BSD 3-Clause
|
||||||
; ======================================================
|
; ======================================================
|
||||||
|
|
||||||
; Set to 1 to turn debug ON with DeZog VSCode plugin
|
; Set to 1 to turn debug ON with DeZog VSCode plugin
|
||||||
@ -32,7 +34,7 @@ DEFAULT_TIMEOUT EQU 2000
|
|||||||
INCLUDE "dss.inc"
|
INCLUDE "dss.inc"
|
||||||
INCLUDE "sprinter.inc"
|
INCLUDE "sprinter.inc"
|
||||||
|
|
||||||
MODULE MAIN
|
MODULE MAIN
|
||||||
|
|
||||||
ORG 0x8080
|
ORG 0x8080
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
@ -57,8 +59,8 @@ EXE_HEADER
|
|||||||
START
|
START
|
||||||
|
|
||||||
IF DEBUG == 1
|
IF DEBUG == 1
|
||||||
; LD IX,CMD_LINE1
|
; LD IX,CMD_LINE1
|
||||||
LD SP, STACK_TOP
|
LD SP, STACK_TOP
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
CALL ISA.ISA_RESET
|
CALL ISA.ISA_RESET
|
||||||
@ -77,29 +79,10 @@ START
|
|||||||
|
|
||||||
CALL WIFI.UART_EMPTY_RS
|
CALL WIFI.UART_EMPTY_RS
|
||||||
|
|
||||||
; IF TRACE
|
|
||||||
; ; Dump, DLB=0 registers
|
|
||||||
; LD BC, 0x0800
|
|
||||||
; CALL DUMP_REGS
|
|
||||||
|
|
||||||
; ; Dump, DLAB=1 registers
|
|
||||||
; LD HL, REG_LCR
|
|
||||||
; LD E, LCR_DLAB | LCR_WL8
|
|
||||||
; CALL WIFI.UART_WRITE
|
|
||||||
|
|
||||||
; LD BC, 0x0210
|
|
||||||
; CALL DUMP_REGS
|
|
||||||
|
|
||||||
; LD HL, REG_LCR
|
|
||||||
; LD E, LCR_WL8
|
|
||||||
; CALL WIFI.UART_WRITE
|
|
||||||
; ENDIF
|
|
||||||
|
|
||||||
; Turn local echo Off
|
|
||||||
CALL WCOMMON.INIT_ESP
|
CALL WCOMMON.INIT_ESP
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Do Some
|
; Do Some
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
|
|
||||||
OK_EXIT
|
OK_EXIT
|
||||||
@ -107,64 +90,11 @@ OK_EXIT
|
|||||||
JP WCOMMON.EXIT
|
JP WCOMMON.EXIT
|
||||||
|
|
||||||
|
|
||||||
DUMP_REGS
|
|
||||||
LD HL, PORT_UART_A
|
|
||||||
|
|
||||||
|
|
||||||
DR_NEXT
|
|
||||||
LD DE,MSG_DR_RN
|
|
||||||
CALL HEXB
|
|
||||||
INC C
|
|
||||||
|
|
||||||
CALL WIFI.UART_READ
|
|
||||||
PUSH BC
|
|
||||||
LD C,A
|
|
||||||
LD DE,MSG_DR_RV
|
|
||||||
CALL HEXB
|
|
||||||
PUSH HL
|
|
||||||
|
|
||||||
PRINTLN MSG_DR
|
|
||||||
|
|
||||||
POP HL,BC
|
|
||||||
INC HL
|
|
||||||
DJNZ DR_NEXT
|
|
||||||
RET
|
|
||||||
|
|
||||||
MSG_DR
|
|
||||||
DB "Reg[0x"
|
|
||||||
MSG_DR_RN
|
|
||||||
DB "vv]=0x"
|
|
||||||
MSG_DR_RV
|
|
||||||
DB "vv",0
|
|
||||||
|
|
||||||
; ------------------------------------------------------
|
|
||||||
; Byte to hex,
|
|
||||||
; Inp: C
|
|
||||||
; Out: (DE)
|
|
||||||
; ------------------------------------------------------
|
|
||||||
HEXB
|
|
||||||
LD A,C
|
|
||||||
RRA
|
|
||||||
RRA
|
|
||||||
RRA
|
|
||||||
RRA
|
|
||||||
CALL CONV_NIBLE
|
|
||||||
LD A,C
|
|
||||||
CONV_NIBLE
|
|
||||||
AND 0x0f
|
|
||||||
ADD A,0x90
|
|
||||||
DAA
|
|
||||||
ADC A,0x40
|
|
||||||
DAA
|
|
||||||
LD (DE), A
|
|
||||||
INC DE
|
|
||||||
RET
|
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Custom messages
|
; Custom messages
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
MSG_START
|
MSG_START
|
||||||
DB "WTerm terminal for Sprinter-WiFi by Romych's, (c) 2024\r\n", 0
|
DB "Terminal for Sprinter-WiFi by Sprinter Team. v1.0.1, ", __DATE__, "\r\n", 0
|
||||||
|
|
||||||
; ------------------------------------------------------
|
; ------------------------------------------------------
|
||||||
; Custom commands
|
; Custom commands
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user