commit c0d5110ea76ad1a757ec6ed33cb6c5ef0d1cddc1 Author: Alex Date: Mon Aug 31 21:04:48 2026 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e91d9e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Editor/OS cruft +.vscode/ +.idea/ +*.swp +Thumbs.db +desktop.ini +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c36ce1 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +![ZiFi](http://zifi.vtrd.in/logo.png "ZiFi") + +**#ZiFi - Internet client for ZX Evolution with TS Conf** + +About project (ru): [ZiFi homepage ](http://zifi.vtrd.in), [ZiFi или интернет для Z80 ](http://hype.retroscene.org/blog/dev/363.html), +[ZiFi v. 0.61 released! ](http://hype.retroscene.org/blog/dev/391.html) + +**Work with sites:** vtrdos, zxart, prods.tslabs, hype, pouet, irclogs; + +**Download:** games, system progs, demopack disk's, diskmag's; + +**See:** zx spectrum screens; + +**Listen:** Ay8910 chip music + +![ZiFi splash](http://hype.retroscene.org/uploads/images/00/00/14/2016/04/15/475aec.png "ZiFi splash") + +_Work with cable socket driver by PSB and Wifi module ESP8266, driver by DDp / Hacker VBI_ +> For Z80 CPU + +## Доработки в этой сборке (2026) + +Оригинальный проект давно не поддерживается автором, поэтому часть функций пришлось переделать под текущее состояние сети и сервисов. + +**Убрана проверка обновлений по HTTP.** Раньше при загрузке клиент ходил на `zifi_ver.php`, проверял версию, при необходимости скачивал новую прошивку и сверял CRC16. Сервер обновлений больше не обновляется — вся эта ветка (`autoupdate`, CRC16, скачивание `.spg`) убрана из `zifi.asm`. + +**Синхронизация времени переведена на стандартные AT-команды SNTP.** Используется штатный протокол ESP-AT — он есть в том числе в обычной прошивке для ESP-01/ESP8266: +``` +AT+CIPSNTPCFG=1,0,"pool.ntp.org" — включить SNTP, UTC, публичный сервер +AT+CIPSNTPTIME? — получить текущее время +``` +Ответ (`+CIPSNTPTIME:Www Mmm dd hh:mm:ss yyyy`) разбирается прямо на Z80 — с учётом того, что синхронизация происходит в фоне и первые секунды может отдавать заглушку 1970 года (в этом случае клиент подождёт и переспросит, с ограничением по числу попыток, чтобы не подвесить загрузку насовсем). + +Часовой пояс по-прежнему берётся из `zifi.ini` (`time: +N` / `time: -N` / `time: none`) и применяется на стороне Z80 поверх времени UTC от SNTP. + +Заодно в RTC (DS1685) теперь пишутся **секунды** и **день недели** (`0` = воскресенье) — раньше эти два поля не заполнялись вообще. + +**Папка загрузок снова работает как раньше** (`downloads/<дата>`, а не корень SD-карты) — при каждой загрузке дата читается напрямую из микросхемы часов, независимо от того, включена ли синхронизация времени в `zifi.ini`. + +**Добавлена поддержка HTTPS.** Часть сайтов в списках загрузок (`prods.tslabs.info`, `bbb.retroscene.org`) перестала пускать по обычному http и принудительно перенаправляет на https. Клиент теперь сам определяет схему ссылки и выбирает `AT+CIPSTART="TCP",...,80` или `AT+CIPSTART="SSL",...,443` — это касается и ссылок из меню, и ссылок, которые сервер присылает внутри списков файлов. + +**Сообщение о готовности.** После завершения всех этапов загрузки (подключение к Wi-Fi, синхронизация времени, папка загрузок) на экране появляется `"ZiFi is ready."` — раньше было не всегда понятно, можно ли уже пользоваться меню. + +**Мелкие исправления:** +- обращение к порту `#EFF7` (общий системный регистр — управляет не только доступом к часам, но и видеорежимом/turbo/кэшем) переведено на read-modify-write вместо прямой перезаписи всего байта, чтобы не сбивать остальные настройки; +- исправлен баг в разборе двузначного GMT-смещения из `zifi.ini` (например `+10`) — были перепутаны местами разряды. + + diff --git a/STS.TRD b/STS.TRD new file mode 100644 index 0000000..0498f61 Binary files /dev/null and b/STS.TRD differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/Appearance Pak.dll b/_esp/CoolTermWin/CoolTerm Libs/Appearance Pak.dll new file mode 100644 index 0000000..80eb434 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/Appearance Pak.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/Crypto.dll b/_esp/CoolTermWin/CoolTerm Libs/Crypto.dll new file mode 100644 index 0000000..1dafac5 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/Crypto.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/Internet Encodings.dll b/_esp/CoolTermWin/CoolTerm Libs/Internet Encodings.dll new file mode 100644 index 0000000..2760f8a Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/Internet Encodings.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/RegEx.dll b/_esp/CoolTermWin/CoolTerm Libs/RegEx.dll new file mode 100644 index 0000000..c6a4614 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/RegEx.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/XML.dll b/_esp/CoolTermWin/CoolTerm Libs/XML.dll new file mode 100644 index 0000000..61f47e2 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/XML.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/XojoGUIFramework32.dll b/_esp/CoolTermWin/CoolTerm Libs/XojoGUIFramework32.dll new file mode 100644 index 0000000..53c6f51 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/XojoGUIFramework32.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/msvcp120.dll b/_esp/CoolTermWin/CoolTerm Libs/msvcp120.dll new file mode 100644 index 0000000..a237d2d Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/msvcp120.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Libs/msvcr120.dll b/_esp/CoolTermWin/CoolTerm Libs/msvcr120.dll new file mode 100644 index 0000000..8c36149 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Libs/msvcr120.dll differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/AboutIcon.png b/_esp/CoolTermWin/CoolTerm Resources/AboutIcon.png new file mode 100644 index 0000000..e1f5d53 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/AboutIcon.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/AboutIcon2x.png b/_esp/CoolTermWin/CoolTerm Resources/AboutIcon2x.png new file mode 100644 index 0000000..257349b Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/AboutIcon2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/AutoScroll-small.png b/_esp/CoolTermWin/CoolTerm Resources/AutoScroll-small.png new file mode 100644 index 0000000..272230a Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/AutoScroll-small.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Icon.bmp new file mode 100644 index 0000000..c37ebc6 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Mask.bmp new file mode 100644 index 0000000..0ab7f46 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/CaptureText-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Icon.bmp new file mode 100644 index 0000000..01fe750 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Mask.bmp new file mode 100644 index 0000000..8573652 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Clear-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Clear_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Clear_Icon.bmp new file mode 100644 index 0000000..541fe32 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Clear_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Clear_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Clear_Mask.bmp new file mode 100644 index 0000000..1a26c31 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Clear_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Close-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Close-small_Icon.bmp new file mode 100644 index 0000000..f497109 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Close-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Close-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Close-small_Mask.bmp new file mode 100644 index 0000000..b23eafd Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Close-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon.bmp new file mode 100644 index 0000000..adf84e6 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon_small.bmp b/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon_small.bmp new file mode 100644 index 0000000..28d645e Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Connect_Icon_small.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask.bmp new file mode 100644 index 0000000..33bde57 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask_small.bmp b/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask_small.bmp new file mode 100644 index 0000000..c16bf51 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Connect_Mask_small.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Icon.bmp new file mode 100644 index 0000000..90620c8 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Mask.bmp new file mode 100644 index 0000000..4f287f8 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Copy-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Icon.bmp new file mode 100644 index 0000000..d304d18 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Mask.bmp new file mode 100644 index 0000000..4991c8f Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Cut-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon.bmp new file mode 100644 index 0000000..548a688 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon_small.bmp b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon_small.bmp new file mode 100644 index 0000000..1fb29ba Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Icon_small.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask.bmp new file mode 100644 index 0000000..9f5ee51 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask_small.bmp b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask_small.bmp new file mode 100644 index 0000000..17409e5 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Disconnect_Mask_small.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/DocIcon0.ico b/_esp/CoolTermWin/CoolTerm Resources/DocIcon0.ico new file mode 100644 index 0000000..cac2bcb Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/DocIcon0.ico differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Flush_Icon_small.png b/_esp/CoolTermWin/CoolTerm Resources/Flush_Icon_small.png new file mode 100644 index 0000000..24a2c93 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Flush_Icon_small.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Help Text.txt b/_esp/CoolTermWin/CoolTerm Resources/Help Text.txt new file mode 100644 index 0000000..0c25ae6 --- /dev/null +++ b/_esp/CoolTermWin/CoolTerm Resources/Help Text.txt @@ -0,0 +1,322 @@ +CoolTerm - Help + +Contents +- Overview +- Quick Start +- Connection Options +- Plain Text and Hexadecimal Display Mode +- Sending Strings +- Capturing Received Data +- Launching CoolTerm from the Command Line +- Configurations for advanced users + + + +Overview + +CoolTerm is an easy-to-use terminal for communication with hardware connected to serial ports. + +CoolTerm is a simple serial port terminal application (no terminal emulation) that is geared towards hobbyists and professionals with a need to exchange data with hardware connected to serial ports such as servo controllers, robotic kits, GPS receivers, microcontrollers, etc. + +The features of CoolTerm include: +- Capability of multiple concurrent connections if multiple serial ports are available. +- Display of received data in plain text or hexadecimal format. +- Sending data via keypresses as well as a "Send String" dialog that supports data entry in plain text or hexadecimal format. +- Sending data via copy-paste of text into the terminal window. +- Sending of text files. +- Capability of capturing received data to text files. +- Local echo of transmitted data. +- Local echo of received data (loop back to sender). +- Hardware (CTS, DTR) and software flow control (XON). +- Optical line status indicators. +- Capability of manually toggling line states of certain handshaking signals when hardware flow control is disabled. +- Configurable character and line delays. +- Capability of saving and retrieving connection options. +- and more... + + +Quick Start + +- Use the Connection Options dialog to configure your serial port. +- Click Connect to open the serial port and use the keyboard to type the characters to be sent. +- Received data will be displayed in the terminal window. Use View Hex to view the data in the terminal window in hexadecimal format. +- Use Connection/Send String... to send strings of text. This dialog allows data to be entered as plain text or in hexadecimal format for special characters. +- Use Connection/Send Textfile... to send entire text files. +- Received data can be recorded to textfile using Connection/Capture to Textfile. +- Line states are indicated via the indicator icons in the lower right corner of the terminal window. +- Line states that can be toggled manually are indicated by a bold font type. Click the indicator to toggle the line state of such a signal. +- Display preferences such as Font, Text Color and Background Color can be configured via the File/Preferences... menu. + +Connection options can be saved and retrieved via the File/Save and File/Open menu items. +It is possible to define the default connection options that are applied each time a new terminal window is opened. To create customized default connection options, use "File/Save As Default" to save the current settings to a 'default.stc' file which will be placed in the same folder in which the CoolTerm application resides. The settings in this file will be applied as default to new terminal windows. + +To open a new Terminal, use File/New. + +Viewing Options (View Menu) +Plain Text and Hexadecimal Display Mode +The display mode of the terminal window can be switched between plain text and hexadecimal via the View Hex/View ASCII toolbar button. Hex mode is particularly useful when characters are received that can not be displayed in plain text. +Characters to be sent can be typed via the keyboard, independent of the current display mode. + +Autoscroll +If enabled, the data display (ASCII and Hex mode) is automatically scrolled to the bottom when new data is received to show the new data. If disabled, the data display is not automatically scrolled. + +Clear Data +Clears the data display (ASCII and Hex). + +Status LEDs +The status LEDs display the line states of various serial port signals. A lit LED indicates the "active" state of a signal. An unlit LED indicates that the signal is "inactive". + + +CoolTerm Menus + +File +New: Open a new terminal window. +Open…: Load connection settings. +Close: Close the terminal window. +Save…: Save the current connection settings. +Save As…: Save the current connection settings using the file save dialog. +Save As Default: Save the current connection settings as default.stc into the CoolTerm application directory. +Preferences…: Open the preferences dialog. +Quit: Quit CoolTerm. + +Connection +Connect/Disconnect: Open/Close the serial port. +Options…: Open the connection settings window. +Reset Port: Reset the serial port. Unlock the port if XOFF is active. +Send Break: Send a break signal. +Flush Serial Port: Flush the serial port buffers. +Send String…: Open a "Send String" window. +Send Textfile…: Select a textile to send via a file open dialog. +Capture to Textfile: Start/Stop/Pause/Resume capture of received data to a text file. + +View +View Hex/Plain: Switch to Hex or Plain text view. +Autoscroll: Enable/Disable automatic scrolling. +Clear Data: Clear the CoolTerm receive data buffer. + + +Connection Options + +Connection options can be saved and retrieved via the File/Save and File/Open menu items. +It is possible to define the default connection options that are applied each time a new terminal window is opened. To create customized default connection options, use "File/Save As Default" to save the current settings to a 'default.stc' file which will be placed in the same folder in which the CoolTerm application resides. The settings in this file will be applied as default to new terminal windows. + +To modify the Connection Options, click the Options in the toolbar or use the Connection/Options... menu to open the Connection Options Window. The options are divided into the following categories: + +Serial Port +Serial port specific options can be adjusted here. The port can not be changed while the connection is open. Close the connection first to change the port. All other settings can be changed while the connection is open. + +Serial Port Options +Select the serial port from the popup menu and configure its settings according to the requirements (Baudrate, Data Bits, Parity, etc.) of the connected hardware. +If the serial port to be used is not listed in the popup menu (e.g. in case it is a USB to Serial port adapter that was connected after CoolTerm was started) push the Re-Scan Serial Ports button. Should the serial port still not be available for selection, ensure that the proper drivers for the serial port are installed. +Additional information (such as driver names and rated speeds) about the selected port can be displayed by clicking the bevel button to the right side of the Port: popup menu. + +Initial Line States when Port opens +This can be used to set the initial state of the RTS and DTR status lines when the respective hardware flowcontrol options are not enabled. + + +Terminal +Options related to terminal behavior are adjusted here. These options are accessible regardless of the connection state of the serial port. + +Terminal Options +Terminal Mode +Sets the operating mode of the terminal. In Raw Mode every key is sent via the serial port immediately as it is pressed. When in Line Mode, a command line field is visible in the terminal window. Characters typed in this field are added to a send buffer. The contents of the send buffer (i.e. one line of text) are sent when the enter key is pressed. +Line Mode supports History. I.e. the up and down arrow keys can be used to send previously typed lines. Alternatively, the square button to the right of the command line field can be pressed to show a history of previously sent lines. Select any line to add it to the send buffer. + +Enter Key Emulation +Defines what character(s) to send when the Enter key is pressed. When in Line Mode, the contents of the send buffer are terminated with the character(s) selected here before they are sent. + +Local Echo +If checked, locally entered data will be echoed in the terminal window. + +Replace TAB key with spaces +If checked, TAB key presses are replaced with the number of spaces specified in the field below. Default is 4, with a maximum of 32. + +Special Character Handling +Filter ASCII Escape Sequences (ASCII View) +If checked, ASCII Escape Sequences will be removed from the received data in ASCII view mode. + +Convert Non-printable Characters (ASCII View) +If checked, non-printable characters (ASCII codes 0 to 31) will be displayed as a period character in ASCII View mode. + +Handle BS and DEL Characters +If checked, Backspace (BS, ASCII code 0x08) and Delete (DEL, ASCII 0x7f) characters will be visually handled in ASCII View mode. When either character is received (or typed with local echo enabled) the previous character in the ASCII viewer is deleted. + +Handle Bell Character +If checked, received bell characters (ASCII code 7) will play a terminal beep. + +Handle Form Feed Character +If checked, the reception of a FF character (ASCII code 12) will clear previously received characters from the receive buffer and thus clear the screen. + +Handle End Of Text Character +Enabling this feature will prevent the display from updating until a EOT (ASCII code 4) character is received, at which time the display is updated with the contents from the receive buffer. +If Local Echo is enabled while this feature is enabled as well, locally echoed characters will cause the display to refresh immediately. + +Use UTF-8 to display plain text +Enables displaying plain text using UTF-8 encoding for received data in UTF-8 format. +Note that UTF-8 may not be supported for all platforms and/or font selection. Other special character handling may also impact UTF-8 display. + +Receive +Settings with regard to received data can be adjusted here. These options are accessible regardless of the connection state of the serial port. + +Receive Options +Loop back received data +If checked, all received data will be echoed back to the sender. This is a useful feature e.g. when working with hardware that has a built-in selftest which requires a loopback adapter. CoolTerm can act as such a loopback adapter and it allows for the data to be observed in the terminal window. + +Ignore receive signal errors +If un-checked, CoolTerm will notify the users of signal errors (e.g. an attached device toggles a line state unexpectedly) and close the serial port. If checked, such errors will be ignored and the serial port will remain open. + +Receive Buffer Size +The receive buffer, i.e. the amount of data being retained by the terminal window at any given time, is limited to the number of characters specified by this value. To avoid slow performance as the receive buffer fills up, this number should be kept small. The receive buffer size is limited to 2,147,483,647 (2GB) Bytes or less on systems with less available memory. +For use cases where CoolTerm is operated on a battery powered computer, it is also recommended to keep the receive buffer as small as possible in order to reduce strain on the CPU. + +Capture Text Options +The Capture raw data and Capture data in Hex format selections determine how received data is stored in the capture file. Raw data capture is suitable when a true representation of the received date is to be captured. Capturing data Hex format provides a way of recording binary data in a more human readable form. + +Add timestamps to received data +This option is suited for data logging applications. Timestamps are added whenever new data is available, i.e. a new DataAvailable events generated by the serial port API. + +Wait for termination string +If enabled, CoolTerm will inspect received data for the specified termination string and only generate a timestamp and capture the data to file when such a string is received. This is useful for datalogging equipment that terminate their data with specific characters such as CR+LF. Enabling this option will log one line of data each time the termination string is received. + +Termination String +This specifies the termination string CoolTerm expects to receive before capturing data to file, if Wait for termination string is enabled. + +Type +This specifies the timestamp type. The following types are available: +- Absolute Date and Time: The current date and time. The format is per the CoolTerm preferences setting. +- Absolute Time: The current time only. The format is per the CoolTerm preferences setting. +- Relative Time: The time that has passed since the start of capture, with millisecond resolution. The format is as follows: HH:MM:SS.sss, where sss denotes milliseconds. + +Capture Local Echo +If checked, the local echo (if enabled in the Terminal Options) of transmitted data will be captured in addition to the received data. + +Leave File open while capturing +If checked (default), CoolTerm will maintain a lock on the capture file by leaving it open as long as capturing is in progress. +If unchecked, the file will be closed each time after writing to it, and reopened when new data arrives. This allows other applications to read the contents of the capture file while capturing is in progress. This can be useful in automated environments where received data needs to be available to other applications. +NOTE: This option should be used with caution. The capture file should only be opened "read-only" by other applications so that CoolTerm can write new data to it. + +Autostart on open +If enabled, capturing to text file is started automatically after the connection settings are loaded. The path to where the data is stored can be set via the Capture File Location field below. + +Append to auto capture file +If disabled (default), a new auto capture file is created each time auto capture is started (i.e. each time the connection settings are loaded). A new auto capture file name will be time stamped with the time at which the file was created. +If this option is enabled and a capture file already exists, CoolTerm will append new data to the existing file. +If this option is enabled and a capture file does not already exist, CoolTerm will create one in the specified location. +NOTE: This option should not be enabled for connection settings that are saved as default. + + +Transmit +Settings with regard to transmission of data can be adjusted here. These options are accessible regardless of the connection state of the serial port. + +Transmit Options +Use transmit character delay +Checking this option enables a character delay specified by the value (in milliseconds) in the Delay text field below. This option guarantees a minimum time between characters to support targets with limited or no receive buffering in order to avoid data loss during transmission. This option is also recommended for targets that employ CTS flow control. At least 3ms delay between characters should be allowed for software and hardware latency on the PC side to shut off data flow when using a CTS command. The maximum character delay that can be specified is 10,000ms. + +Use transmit line delay +Checking this option enables a delay specified by the value (in milliseconds) in the Delay text field below. This option guarantees a minimum time after certain characters which are specified in the Delay characters text field below. The default is the Line Feed character (ASCII 10, or 0A hex). This supports targets that execute commands upon receipt of such a character and won't be able to process new data for a certain amount of time. The maximum line delay that can be specified is 10,000ms. + +Send String Options +Terminate 'Send String' Data +Enables automatic termination of strings sent by Send String windows with a configurable Termination String. When pressing Send in any Send String window, the Termination String is automatically appended to the sent data. + +Termination String +If enabled, this String is automatically appended when sending data from Send String windows. + +Send Text Options +Notify after sending text files +If enabled, a short notification sound will be played upon completion of sending a text file. + + +Miscellaneous +Misc. Options +Automatically connect on open +If checked, the specified serial port will automatically open if these connection settings are loaded via the File/Open menu item. If this option is enabled in the 'default.stc' connection options file in the CoolTerm application directory, the serial port will be opened automatically whenever a new terminal is opened. Note, that each physical serial port can only be opened once, i.e. if a port is already opened, attempts to open the same port in another terminal window will cause a connection error. + +Automatically disconnect on close +If checked, the serial port is closed automatically when the terminal window is being closed. If unchecked, CoolTerm will warn the user if it is attempted to close the window while the connection is still open. + +Reduce Display Refresh Rate +If checked, this option reduces the terminal refresh rate to once per second, i.e. status texts, status LEDs, as well as displayed serial data are only refreshed once per second. This is useful to reduce strain on the CPU in setups where CoolTerm is operated on a battery powered computer. Note that this will not reduce the rate at which CoolTerm receives data, it only reduces the rate at which it is displayed. + + +Sending Strings + +Strings of text can be sent via the Send String dialog windows which can be opened via the Connection/Send String... menu. Multiple Send String windows can be open at the same time. Strings can be entered in plain text as well as in hexadecimal mode. The modes can be switched between ASCII and Hex at any time. When entering data in hexadecimal mode, 2 hex-digits must be used for every character. It is not necessary to use spaces between characters. Press the Send button to send the string to the serial port. Pressing Shift+ENTER or Shift+RETURN will also invoke the "Send" button. +NOTE: The serial port must be open to send strings. If the serial port is not open, the Send button is disabled. + + +Sending Text Files + +Entire text files can be transmitted via the Connection/Send Textfile... menu. Transmitting text files is only possible when the serial port is open. Use the file dialog opened by Connection/Send Textfile... to navigate to the text file to be sent. +Text files can also be sent via drag-and-drop. Drag the text file to be sent and drop it onto the terminal window with which to send the file. + + +Capturing Received Data + +CoolTerm is capable of capturing received data to textfiles. +- Use the Connection/Capture to TextFile/Start... menu to open a file dialog. +- Specify the location and the name of the capture file and press Save. This will start the capture. +- To pause capturing, use Connection/Capture to TextFile/Pause. +- To resume capturing, use Connection/Capture to TextFile/Resume. +- To pause capturing and close the capture file, use Connection/Capture to TextFile/Stop. + + +Launching CoolTerm from the Command Line + +CoolTerm can be launched from the command line, using the paths to settings files as arguments. If launched without an argument, the 'default.stc' settings file will be loaded if it exists. If one or more settings file paths are passed as arguments (separated by spaces), each one will be opened when CoolTerm launches. + +Examples: + +Mac: open CoolTerm.app setting1.stc setting2.stc setting3.stc +Win: CoolTerm.exe setting1.stc setting2.stc setting3.stc +Linux: CoolTerm setting1.stc setting2.stc setting3.stc + + + +Configuration for Advanced Users + +Adding extra serial ports to the selection in Connection Options + +In case the system has serial ports that can not be discovered by CoolTerm, such as the /dev/tty.xxx devices on OS X, a text file named "ports.ini" can be placed inside the same directory in which the CoolTerm application resides. Additional ports can be added to this file, one per line. At startup, CoolTerm will read the contents of this file and attempt to obtain handles on the listed devices. Devices with valid handles will then be accessible via the Connection Settings. + + +Adding extra baudrates to the selection in Connection Options + +CoolTerm only lists the baudrates that are guaranteed to work on all platforms. However, some USB adapter are knowns to work with higher/non-standard baudrates such as 128000, 153600, 256000, 460800, or even 921600 baud. Some users may have hardware that require lower baudrates, such as 150, 110, or 100 baud. To use such baudrates in CoolTerm, create and place a "baudrates.ini" file inside the same directory in which the CoolTerm application resides. Additional baudrates can be added to this file, one per line. At startup, CoolTerm will read the contents of this file and the additional baudrates will then be accessible via the Connection Settings. When selecting one of these additional baudrates, CoolTerm will attempt to pass the baudrates to the driver. + +NOTE: There is no guarantee that setting the baudrate to one of these settings will produce the desired result. In case a value is not accepted by the driver, CoolTerm will generate an "Invalid Option" error message. But there are other cases where the driver will accept the value, but not actually generate the correct baudrate. Such cases include some of the lower baudrates like 150, 110, and 100 baud. Only Keyspan USB adapters have been found to support such settings reliably. Both FTDI and Prolific adapters produce baudrates around 30kBaud when set to one of these settings. The user is required to verify that the port is set to the correct baudrate when selecting a non-standard setting. Reports of adapters that reliably support the lower baudrates will be appreciated. + + +Removing serial port names from connection settings + +When connection settings are saved, the name of the selected serial port is stored in the settings file to ensure that the specified port is selected the next time the connection settings are loaded. However, there are times or situations when this may not be desired, such as systems where serial port adapters are only temporarily plugged in or where such adapters are changed frequently. +The settings files are human readable and can be openend with a text editor. To prevent CoolTerm from selecting the port specified in the settings, simply remove the line of text that specifies the port name (the first line) from the settings file. This will cause CoolTerm to select the first available serial port instead of selecting a specified one. This will also prevent the "The serial port XXX is not available" warning when the settings file is loaded and the specified port can't be found. It is recommended use this technique for default (default.stc) settings on systems where it is not guaranteed that the specified port is always available. + +Example: + +turn this: +Port = KeySerial1 +BaudRate = 115200 +DataBits = 8 +... + +into this: +BaudRate = 115200 +DataBits = 8 +... + +It is also possible to make CoolTerm prompt the user to select a serial port when a settings file is loaded. This may useful for generic settings files for specific use cases or hardware devices where the name of the serial port is not known beforehand. To achieve this, delete the serial port name from the settings file but otherwise leave the Port = line intact. + +Example: + +turn this: +Port = KeySerial1 +BaudRate = 115200 +DataBits = 8 +... + +into this: +Port = +BaudRate = 115200 +DataBits = 8 +... \ No newline at end of file diff --git a/_esp/CoolTermWin/CoolTerm Resources/Help-Small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Help-Small_Icon.bmp new file mode 100644 index 0000000..60ab7d7 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Help-Small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Help-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Help-small_Mask.bmp new file mode 100644 index 0000000..d17ade8 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Help-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Help_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Help_Icon.bmp new file mode 100644 index 0000000..09a65e6 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Help_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Help_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Help_Mask.bmp new file mode 100644 index 0000000..0fd163e Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Help_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive.png new file mode 100644 index 0000000..3e091ae Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive2x.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive2x.png new file mode 100644 index 0000000..4567d2d Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusActive2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive.png new file mode 100644 index 0000000..b5622f9 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive2x.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive2x.png new file mode 100644 index 0000000..e5cc8e8 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusInactive2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone.png new file mode 100644 index 0000000..bc940c1 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone2x.png b/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone2x.png new file mode 100644 index 0000000..f121e9e Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/LineStatusNone2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/New-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/New-small_Icon.bmp new file mode 100644 index 0000000..61d9c32 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/New-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/New-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/New-small_Mask.bmp new file mode 100644 index 0000000..df4b167 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/New-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/New_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/New_Icon.bmp new file mode 100644 index 0000000..6cae7bb Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/New_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/New_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/New_Mask.bmp new file mode 100644 index 0000000..b9e3d0a Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/New_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Icon.bmp new file mode 100644 index 0000000..b8e7c37 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Mask.bmp new file mode 100644 index 0000000..e336863 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/OpenFile-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Icon.bmp new file mode 100644 index 0000000..e40d295 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Mask.bmp new file mode 100644 index 0000000..a3495ce Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/OpenFile_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Options-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Options-small_Icon.bmp new file mode 100644 index 0000000..6cecc9f Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Options-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Options-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Options-small_Mask.bmp new file mode 100644 index 0000000..fe494db Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Options-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Options_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Options_Icon.bmp new file mode 100644 index 0000000..4c75523 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Options_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Options_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Options_Mask.bmp new file mode 100644 index 0000000..db51a8c Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Options_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Icon.bmp new file mode 100644 index 0000000..12aa258 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Mask.bmp new file mode 100644 index 0000000..100bad4 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Paste-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Icon.bmp new file mode 100644 index 0000000..ecd4485 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Mask.bmp new file mode 100644 index 0000000..5512d2f Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/PauseRecording-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Icon.bmp new file mode 100644 index 0000000..6de1d87 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Mask.bmp new file mode 100644 index 0000000..9dc8b26 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Preferences-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Reset-small.png b/_esp/CoolTermWin/CoolTerm Resources/Reset-small.png new file mode 100644 index 0000000..c820ba5 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Reset-small.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Resources.sdef b/_esp/CoolTermWin/CoolTerm Resources/Resources.sdef new file mode 100644 index 0000000..3c4ff86 --- /dev/null +++ b/_esp/CoolTermWin/CoolTerm Resources/Resources.sdef @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Icon.bmp new file mode 100644 index 0000000..a653403 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Mask.bmp new file mode 100644 index 0000000..ceac163 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFile-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Icon.bmp new file mode 100644 index 0000000..da33003 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Mask.bmp new file mode 100644 index 0000000..0ebc28f Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFileAs-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Icon.bmp new file mode 100644 index 0000000..3ba71a0 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Mask.bmp new file mode 100644 index 0000000..83f64ee Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SaveFile_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendBreak_small.png b/_esp/CoolTermWin/CoolTerm Resources/SendBreak_small.png new file mode 100644 index 0000000..aefd46d Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendBreak_small.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Icon.bmp new file mode 100644 index 0000000..774db45 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Mask.bmp new file mode 100644 index 0000000..4de6dbb Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendString-Small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Icon.bmp new file mode 100644 index 0000000..ae24164 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Mask.bmp new file mode 100644 index 0000000..c8ca0ea Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendText-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SendTextDone.wav b/_esp/CoolTermWin/CoolTerm Resources/SendTextDone.wav new file mode 100644 index 0000000..fd15934 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SendTextDone.wav differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Icon_16x16.bmp b/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Icon_16x16.bmp new file mode 100644 index 0000000..a2e167c Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Icon_16x16.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Mask_16x16.bmp b/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Mask_16x16.bmp new file mode 100644 index 0000000..da4f9ef Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SimpleTerm_Mask_16x16.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SplashIcon.png b/_esp/CoolTermWin/CoolTerm Resources/SplashIcon.png new file mode 100644 index 0000000..257349b Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SplashIcon.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/SplashIcon2x.png b/_esp/CoolTermWin/CoolTerm Resources/SplashIcon2x.png new file mode 100644 index 0000000..88c8388 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/SplashIcon2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Icon.bmp new file mode 100644 index 0000000..c4ac9dd Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Mask.bmp new file mode 100644 index 0000000..8995d06 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/StartRecording-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Icon.bmp new file mode 100644 index 0000000..c2b7376 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Mask.bmp new file mode 100644 index 0000000..9e18d35 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/StopRecording-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/TerminalBeep.wav b/_esp/CoolTermWin/CoolTerm Resources/TerminalBeep.wav new file mode 100644 index 0000000..9d24c1b Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/TerminalBeep.wav differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Icon.bmp new file mode 100644 index 0000000..164b676 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Mask.bmp new file mode 100644 index 0000000..79a6e5f Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Undo-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Viewer-small_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Viewer-small_Mask.bmp new file mode 100644 index 0000000..ec243bd Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Viewer-small_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII-small_Icon.bmp new file mode 100644 index 0000000..3a542ba Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII_Icon.bmp new file mode 100644 index 0000000..5e98f6a Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/ViewerASCII_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX-small_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX-small_Icon.bmp new file mode 100644 index 0000000..7c44f66 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX-small_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX_Icon.bmp b/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX_Icon.bmp new file mode 100644 index 0000000..892941b Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/ViewerHEX_Icon.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/Viewer_Mask.bmp b/_esp/CoolTermWin/CoolTerm Resources/Viewer_Mask.bmp new file mode 100644 index 0000000..91eff3a Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/Viewer_Mask.bmp differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/mwx.png b/_esp/CoolTermWin/CoolTerm Resources/mwx.png new file mode 100644 index 0000000..23449ca Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/mwx.png differ diff --git a/_esp/CoolTermWin/CoolTerm Resources/mwx2x.png b/_esp/CoolTermWin/CoolTerm Resources/mwx2x.png new file mode 100644 index 0000000..84c682d Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm Resources/mwx2x.png differ diff --git a/_esp/CoolTermWin/CoolTerm.exe b/_esp/CoolTermWin/CoolTerm.exe new file mode 100644 index 0000000..582e1b3 Binary files /dev/null and b/_esp/CoolTermWin/CoolTerm.exe differ diff --git a/_esp/CoolTermWin/ReadMe.txt b/_esp/CoolTermWin/ReadMe.txt new file mode 100644 index 0000000..6ac8dd4 --- /dev/null +++ b/_esp/CoolTermWin/ReadMe.txt @@ -0,0 +1,317 @@ + + CoolTerm + + Copyright (c) 2007-2015 Roger Meier, + All rights reserved + + http://freeware.the-meiers.org + + + +WHAT IS IT? +=========== + +CoolTerm is an easy-to-use terminal for communication with hardware connected to serial ports. + +CoolTerm is a simple serial port terminal application (no terminal emulation) that is geared towards hobbyists and professionals with a need to exchange data with hardware connected to serial ports such as servo controllers, robotic kits, GPS receivers, microcontrollers, etc. +The features of CoolTerm include: +- Capability of multiple concurrent connections if multiple serial ports are available. +- Display of received data in plain text or hexadecimal format. +- Sending data via keypresses as well as a "Send String" dialog that supports data entry in plain text or hexadecimal format. +- Sending data via copy-paste of text into the terminal window. +- Sending of text files. +- Capability of capturing received data to text files. +- Local echo of transmitted data. +- Local echo of received data (loop back to sender). +- Hardware (CTS, DTR) and software flow control (XON). +- Visual line status indicators. +- Capability of manually toggling line states of certain handshaking signals when hardware flow control is disabled. +- Configurable character and line delays. +- Capability of saving and retrieving connection options. +- and more... + + + +INSTALLATION +============ +CoolTerm comes without an installer and can be placed anywhere on the harddrive as long as the correct folder structure is maintained. I.e. for the Windows version the "CoolTerm Libs" folder must reside in the same location as the "CoolTerm.exe" executable. + + + +HOW TO USE IT +============= +Please refer to the built-in help. + + + +VERSION HISTORY +=============== + +1.4.6: 02/16/16 +--------------- +NEW/CHANGED FEATURES: +- Added the option to automatically start file capture upon loading connection settings. +- Added option to append new data to auto capture files. +- Added option to filter ANSI escape sequences. If this option is enabled, ANSI sequence characters will be filtered in ASCII view mode. +- Added preference option to enable condensing the line spaces in plain text view mode (not available in Universal Binary builds). +- [Win][Linux] Added code to ensure that only one instance of CoolTerm is running on the system at the same time +- Added code to ensure that a connection settings file can only be opened once. +- Added preference option to show or hide the toolbar. +- Added UTF-8 support for plain text view. +- Updated preferences dialog to display extended character set. +- [Win] Added support for AltGr key combinations on certain international keyboards. +- Added shortcut (Mac: CMD-I, Win/Linux: CTRL-I) to Connection/Options... menu. +- Changed relative timestamp format from HH:MM:SS:sss to HH:MM:SS.sss to be consistent with established timestamp conventions. +IMPROVEMENTS: +- Removed CTRL+Alt+S short cut for "File/Save as default" to avoid AltGr+S triggering the short cut. +- [Win][Linux] Changed code to use platform specific default text encoding for the plain text window to allow displaying bytes larger than 0x7f. +- UI Tweaks to harmonize the look of the GUI between platforms. +- Updated Help Text with instructions on how to remove the serial port name from settings files. +BUG FIXES AND STABILITY IMRPOVEMENTS +- [Linux] Updated AutoScroll code to behave the same as it does on Mac and Windows. +- Fixed bug that didn't properly update the text of the Connection/Connect_Disconnect menu when switching between terminal windows. +- [Mac] Fixed bug where the text encoding of strings returned from AppleScript commands was not defined. + + +1.4.5: 02/14/15 +--------------- +NEW/CHANGED FEATURES: +- Added new option to handle Form Feed (FF, ASCII code 12) characters. When enabled, the reception of a FF character will clear the receive buffer and thus clear the screen. +- Added new option to handle End Of Text (EOT, ASCII code 4) characters. Enabling this feature will prevent the display from updating until a EOT character is received, at which time the display is updated with the contents from the receive buffer. +- Added code to present the user with the option to select a serial port if a loaded settings file includes an empty string for the port name. This allows the creation of generic settings files. +- [MAC] Additional retina support. +BUG FIXES AND STABILITY IMRPOVEMENTS +- Code improvement to avoid ThreadAccessingUIException + +NOTE TO MAC USERS: +Version 1.4.x will be the last release of CoolTerm available as Universal Binary. Starting with version 1.5.x, CoolTerm will only be deployed for Intel based Macs. + + +1.4.4: 09/21/14 +--------------- +NEW/CHANGED FEATURES: +- Added feature that shows the path to the current capture file (if a capture is currently active) when the mouse is hovered over the serial port status label at the bottom left of the CoolTerm window. +- changed Enter key emulation settings to use popup menu and added the option use a custom sequence to emulate the enter key. +- Added additional font sizes to preferences dialog. +- Added option to reduce the terminal refresh rate to once per second in order to reduce the CPU load on systems where power consumption is critical. +- Added text the the built in help to explain that reducing the size of the receive buffer can be used to reduce CPU power consumption. +- [MAC] Compiling for Cocoa from now on (intel based Macs only). The universal binary still uses Carbon. +- [MAC] Added basic retina support. +IMPROVEMENTS +- CoolTerm now properly remembers the last used folders (individually) for opening connection settings, capturing to text files, as well as sending text files. +- Added DEL character (ASCII 127) to the routine that handles BS characters in ASCII view. +- optimized code to reduce CPU load while sending text files. +- stability improvement to the code of the circular receive buffer. +BUG FIXES AND STABILITY IMRPOVEMENTS +- fixed code that could cause extended ASCII characters to sometimes be incorrectly translated from hexadecimal format to plain text. + + + +1.4.3: 09/02/2013 +----------------- +NEW/CHANGED FEATURES: +- Added preference setting to select the date and time format used for timestamps. The user can select between the SQL Date/Time format (YYYY-MM-DD HH:MM:SS) or the format determined by the users local system settings. +- Added options to choose the timestamp type and modified the code to fix an bug where the millisecond count and the Date/Time timestamp could get out of sync. It is now only possible to capture timestamps with millisecond resolution when selecting the relative timestamp format. +BUG FIXES AND STABILITY IMPROVEMENTS: +- Made various stability improvements to the code that updates the GUI while data is being sent and received. + + +1.4.2: 02/17/2013 +----------------- +NEW/CHANGED FEATURES: +- Added options to set the initial state of RTS and DTR when the serial port opens. These options will only have an effect if the respective hardware flow control is not enabled. +- Changed the behavior of capturing received data to file when timestamps are enabled. Instead of appending a time stamp at every occurrence of CR and/or LF characters by default, it is now possible to specify the termination string at which to split the data. Furthermore, CoolTerm will now wait until the specified termination string is received until the data is captured to file. +- Added option to convert received data to hex before capturing to a capture file. +- Enabled the "Close Window" short cut for the "Send String" window. +- Added Alt+ENTER short cut for toggling between ASCII and Hex mode in "Send String" +- Added Connection/Reset menu item to provide a way to reset the port and unlock it if XOFF is active. +- Changed the behavior of the text file capturing with regards to the state of the port. It is now possible to start capturing before the port is opened. In addition, capturing is no longer stopped automatically when the port is closed. This allows for capturing to remain enabled even when the connection state of the port changes. +- Added code to allow canceling of a text file transmission in progress if XOFF is active. +- Added option to the connection settings (Misc. Options) to automatically close the serial port when the window is being closed without showing a warning if the port is still open. +- Updated the built-in help with information on all menu items. + +BUG FIXES AND STABILITY IMPROVEMENTS: +- fixed bug that would cause a NilObjectException in the Xmit routine in cases where the serial port is still transmitting or is hung while the port goes out of scope. This hopefully fixes the crash bug some users have experienced on occasion. +- Fixed bug that caused the transmit line delay setting to not properly be saved to connection settings files. +- Made improvements to receive buffer code to avoid resource conflicts. +Windows only: +- Changed file association on windows to work even on systems where the current user may not have administrative privileges. + +APPLESCRIPT: +- Changed AppleScript commands to use unique terminal window IDs instead of the names when addressing windows. +- Added the following AppleScript commands + - WindowCount as integer + - WindowID(Index as integer) as integer + - WindowName(index as integer) as String + - IndexOfWindowID(ID as integer) as integer + - NewWindow as integer + - Quit + - ResetPort(ID as integer) + - FlushPort(ID as integer) + - BytesLeftToSend(ID as integer) as integer + - LastErrorCode(ID as integer) as integer + - GetCTS(ID as integer) as boolean + - GetDSR(ID as integer) as boolean + - GetDCD(ID as integer) as boolean + - GetRI(ID as integer) as boolean + - CaptureStart(ID as integer, FilePath as string) as boolean + - CapturePause(ID as integer) + - CaptureResume(ID as integer) + - CaptureStop(ID as integer) + - SendTextFile(ID as integer, FilePath as string) as boolean + - SendBreak(ID as integer) + - SetDTR(ID as integer, Value as boolean) + - GetDTR(ID as integer) as boolean + - SetRTS(ID as integer, Value as boolean) + - GetRTS(ID as integer) as boolean +- Added code to suppress error messages when CoolTerm is controlled by an AppleScript. +- Updated AppleScriptReadme.txt to reflect latest changes. + + +1.4.1: 11/21/2011 +----------------- +- Improved handling of exceptions if preferences or connection settings can not be read or written. +- Checking serial port for nil in the transmit thread to avoid NilObjectException exceptions. Not clear if this fixes the issue a few users have seen. +- Improved exception handling when serial port adapters are added or removed from the system while CoolTerm is running. +- Fixed a bug in the circular receive buffer that could cause an OutOfBoundsException when reading data. +- Improved handing of OutOfMemoryExceptions when attempting to set the receive buffer size to a value larger than the amount of memory available on the user's system. + + +1.4.0: 9/12/2011 +---------------- +NEW FEATURES: +- New Connection options window with multiple pages. +- The connection options now display port information for the selected port. +- It is now possible to change baudrate, byte format settings, and flow control settings while the port is open. +- Added the option to specify additional baud rates via a "baudrates.ini" file. E.g. any baud rates that are known to be supported by the hardware that are not listed in the popup menu in the connection settings dialog can be added to a "baudrate.ini" file that resides in the same directory as CoolTerm. +- Added the option to specify additional serial ports via a "ports.ini" file. E.g. any devices such as /dev/tty.xxx devices on OSX and Linux that CoolTerm can not enumerate can be added to a "ports.ini" file that resides in the same directory as CoolTerm. +- Added the option to add timestamps to data captured to text files. +- Added a keyboard shortcut to connect/disconnect. +- Added option to replace TAB key presses with a configurable number of spaces (default = 4). +- Added option to enable/disable capturing of local echo of transmitted data in capture files. +- Added an option to keep the capture file open while capturing is in progress (default) or close it after writing and re-opening when new data arrives. This allows other applications to read the capture file while capturing is in progress. +- Added status LEDs for TX and RX to indicate activity related to sending and receiving data. +- Added preferences option to disable all menu shortcuts (on Windows and Linux only) in order to allow sending CTRL characters via the terminal. On Mac, the keyboard shortcuts use the Command key and thus don't interfere with CTRL characters. +- [MAC] AppleScript BETA: Added basic AppleScript handling for the most important terminal operations such as loading a settings file, opening/closing ports, and reading/writing data. The AppleScript functionality, while included in CoolTerm 1.4.0, is currently in public BETA , to allow a broader audience to beta test this feature and provide feedback. Refer to the attached "AppleScript ReadMe.txt" file for more details. +- [LINUX] Making LINUX version (unsupported) available. + +IMPROVEMENTS: +- Made significant improvements to the code that processes received data, including changing architecture of the receive buffer to a circular buffer to improve efficiency and stability. +- Made significant improvements to the code that transmits data, including changing the architecture of the data transmission to be more asynchronous in nature to improve the responsiveness of CoolTerm during transmission of large text files, particularly with XON/XOFF flow control enabled +- CoolTerm now opens a progress window whenever the length of the text to be transmitted exceeds a certain threshold, and not only when text files are sent. +- Flow control settings are now displayed in the terminal window as part of the port configuration string. For XON/XOFF the state is displayed, i.e. XON or XOFF. +- Added error messages to alert the user of errors that occur while attempting to open the serial port. +- Added check to warn the user if multiple files are dropped onto the CoolTerm window. +- "Send String" windows can now be resized. +- It is now possible to send CTRL characters when the terminal is set to Line Mode. +- Improved code for Line Mode to ensure that a pressed key is captured even if the command line didn't have the focus. +- Changed behavior of the status LEDs to better reflect the state of the signals. A green LED turned on now means that a signal is "active", the LED turned off means that it is "inactive". +- Changed the default state of DTR when a port is opened to "active" to conform with common practice, with the exception of Windows platforms when DTR flow control is enabled, in which case the default is "inactive" in order to avoid serial port errors. +- Improved handling of file IO errors when sending textile or capturing received data to textiles. +- Improved handling of file IO errors when reading and writing settings files. +- Improved error reporting. Crash reports will now include information about all open terminals. +- Slight change to the behavior during setting the break signal in that no characters are being read from the receive buffer. Received characters will be read after the break signal has been cleared. + +BUG FIXES: +- Fixed a bug that would show an error message when the user chooses cancel in the capture file save dialog. +- Fixed a bug that threw an exception when opening the connection settings on a system without serial ports installed. +- Fixed a bug the displayed an error message when the user cancelled out of the "Send Textfile" dialog. +- [WIN] Fixed a bug where the removal of a serial port adapter could cause an exception when starting a connection. +- [MAC] Implemented a workaround for a known RB bug where the baudrates 3600, 7200, 14400, and 28800 baud would not be set correctly and default to 57600 baud instead. + + +1.3.1: 1/11/2011 +---------------- +Improvements: +- Added a preferences option to automatically check for updates at startup. + +Fixes: +- Fixed a bug that caused a StackOverFlowException when serial port devices were unexpectedly removed from the system, e.g. when a USB serial adapter was unplugged while the terminal was connected to that device. The error handling for this situation has been improved. +- Fixed a bug that caused an OutOfBoundsException when a serial port device failure occurred during enumeration. +- Fixed a bug that resulted in incorrect formatting of long crash reports. + + +1.3.0: 10/28/2010 +----------------- +New features: +- Added a transmit line delay option which adds a specified delay after certain characters such as new line characters (configurable). +- Added a transmit character delay option (configurable). +- Added a "Connection/Send Break" menu item for sending serial breaks. +- Added the option to play a notification sound after a text file has been sent. +- Added auto-connect feature. +- Added the .hex file extension to the "Text Files" file type set (for the "Send Text File" dialog). +- It is now possible to have default settings loaded at startup and when a new terminal window is opened. If a default.stc settings file exists in the application folder of CoolTerm, it will be applied to new terminal windows. +- Added a menu item to save current settings as default settings. + +Improvements: +- Pressing ENTER or RETURN in the connection settings dialog now envokes the "Ok" button, even if a textfield is currently selected. +- Pressing ESC in the connection settings dialog now invokes the "Cancel" button, even if a textfield is currently selected. +- Pressing Shift+ENTER or Shift+RETURN now invokes the "Send" button in "Send String" windows. +- Improved handling of command line arguments. +- The values for "Receive Buffer Size" and the character and line delays are now limited to a range from 0 to a maximum value (2,147,483,647 and 10,000, respectively). +- When a "Send String" window is opened, the text field now receives focus automatically. +- Improved exception handling and error reporting. +- Improved behavior of the command history buffer and menu. +- GUI improvements. + +Fixes: +- Fixed a bug that allowed opening multiple "Save As..." for the same Terminal window dialogs on Windows. +- Fixed a bug that could cause a StackOverflow on serial port errors due to calling port.flush +- Fixed bug that could cause a crash when sending empty strings via a "Send String" window. +- (Win) Fixed issue that would allow the terminal window to be activated via the taskbar when the connection options window is open. +- Several minor bug fixes. + + +1.2.0: 2/19/2010 +---------------- +- Added "Line Mode" to the communication settings. In "Line Mode" a line of typed text will not be sent to the serial port until the Enter key is pressed. +- Added "History" which is available in "Line Mode" the up and down arrow keys can be used to select previously typed lines. +- Added a receive buffer size limit option. +- Added handling of the bell character (ASCII code 7), which can be enabled through the communication settings. +- It is now possible to open the communication settings and edit certain options while the serial port is open. +- The viewer mode (plain or hex) is now saved as parameter in connection settings files. +- The size and position of terminal windows is now saved with connection settings. +- Fixed bug that converted occurrences CR+CR+LF strings to single spaces on Windows. + + +1.1.2: 7/17/2009 +---------------- +- Separated option to handle backspace characters in ASCII view from option to convert non-printable characters. +- Changed character used to display non-printable characters to a period (ASCII code 46) for better compatibility and consistency across platforms. +- Changed short cuts for "View/Autoscroll" and View Mode menu items to avoid conflict with other menu items such as "Edit/Select All". +- Windows build now associates .stc files with CoolTerm. +- Minor bug fixes. + + +1.1.1: 6/29/2009 +---------------- +- Added option to handle backspace characters in ASCII view to Connection Settings. +- Fixed bug in SendString that prevented typing 8 in hex mode. +- Fixed bug that printed the wrong character for cursor down key when ConvertNonPrint was enabled. +- Added a "Check for Updates" Menu item. + + +1.1.0: 6/18/2009 +---------------- +- Added an option to the connection settings to automatically terminate string sent from "Send String" windows with a configurable "Termination String", such as e.g. a linefeed etc. +- In ASCII view mode, all incoming "New Line" such as CR, LF, CR+LF, are now properly displayed as line breaks. +- Added an option to the connection settings to convert non-printable characters to generic dot characters in ASCII view. +- Added 'View' menu with menu item to switch between Hex and ASCII viewing. +- Moved 'Clear Data' menu item to 'View' menu. +- Added an 'Autoscroll' feature, accessible via the 'View' menu to enable/disable automatic scrolling of received data. +- Changed menu shortcut key for "Cycle through windows" from "0" to "`". +- Added code to produce an audible alert (system beep) when characters are typed while the serial port is not connected. +- Added a 'Help' button to the toolbar + + +1.0.0: 5/19/2009 +---------------- +- Initial Release + + + + +LICENSE +======= + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/_esp/CoolTermWin/esp_init.txt b/_esp/CoolTermWin/esp_init.txt new file mode 100644 index 0000000..d931732 --- /dev/null +++ b/_esp/CoolTermWin/esp_init.txt @@ -0,0 +1,81 @@ +AT +OK +AT+CWJAP_CUR="YV","1234123412" +WIFI CONNECTED +WIFI GOT IP + +OK +AT+CIPSTART="TCP","zxart.ee",80 +busy p... +CONNECT + +OK +AT+CIPSEND=105 +OK +> +Recv 104 bytes + +SEND OK + ++IPD,504:HTTP/1.1 301 Moved Permanently +Date: Sun, 27 Mar 2016 08:29:50 GMT +Server: Apache / DataZone +Location: http://zxart.ee/ +Content-Length: 293 +Connection: close +Content-Type: text/html; charset=iso-8859-1 + + + +301 Moved Permanently + +

Moved Permanently

+

The document has moved here.

+
+
Apache / DataZone Server at zxart.ee Port 80
+ +CLOSED + + + + +AT +OK +AT+GMR +AT version:0.60.0.0(Jan 29 2016 15:10:17) +SDK version:1.5.2(80914727) +compile time:Jan 29 2016 19:06:50 +OK +AT+CWMODE_DEF? busy p... ++CWMODE_DEF:1 + +OK +AT+CWLAP busy p... ++CWLAP:(3,"win",-77,"08:60:6e:24:89:70",13,85,0) ++CWLAP:(4,"YV",-38,"08:60:6e:d2:f7:58",13,86,0) + +OK +AT+CWJAP_CUR="YV","1234123412" WIFI CONNECTED +WIFI GOT IP + +OK +AT+CIPSTA? +CIPSTA:ip:"192.168.1.248" ++CIPSTA:gateway:"192.168.1.1" ++CIPSTA:netmask:"255.255.255.0" + +OK +AT+PING="google.com" +24 + +OK +AT+CIPSTART="TCP","zxart.ee",80 +busy p... +CONNECT + +AT+CIPSEND=104 +GET /index.php HTTP/1.0 +Host: zxart.ee +User-Agent: ZiFi (ZX Evo) +Accept: */* +Connection: close + + diff --git a/_esp/ESPprob2.trd b/_esp/ESPprob2.trd new file mode 100644 index 0000000..8f51113 Binary files /dev/null and b/_esp/ESPprob2.trd differ diff --git a/_esp/Unreal1/Unreal.exe b/_esp/Unreal1/Unreal.exe new file mode 100644 index 0000000..01d95e0 Binary files /dev/null and b/_esp/Unreal1/Unreal.exe differ diff --git a/_esp/Unreal1/Unreal.ini b/_esp/Unreal1/Unreal.ini new file mode 100644 index 0000000..92ca80b --- /dev/null +++ b/_esp/Unreal1/Unreal.ini @@ -0,0 +1,1353 @@ +[*] unreal speccy configuration file + +UNREAL=0.37.9 ; make sure you don't have old INI version + +[MISC] +; give idle timeslices to other applications +ShareCPU=1 ; 1 - only for fast CPUs (incompatible with SoundDrv=none) +; +HighPriority=1 ; boost process priority, disabled on ShareCPU=0 +; +; high memory: PENTAGON, SCORPION, PROFSCORP, GMX, PROFI, ATM450, ATM710, KAY, ATM3, TSL, LSY +HIMEM=TSL +; memory size, KB +RAMSize=4096 + +; ULA+: NONE, TYPE1 (Blue is 000 011 101 111), TYPE2 (Blue is 000 011 100 111) +ULAPLUS=TYPE1 + +; ZX-Evo Video DAC resolution: NONE, 3BIT, 4BIT, 5BIT +TS_VDAC=5BIT + +; OUT (C), 0 value +OUT_C_0=0 + +; KR1858VM1 halt handling +Z80_VM1=0 + +TapeTraps=1 +; start tape on ROM load routine + +TapeAutoStart=1 +; cmos on DFF7/BFF7: none, DALLAS (pc chip), or 512Bu1 (russian chip) + +CMOS=DALLAS +; cache size: 16,32 or 0 - disabled. no effect for ATM-4.50 model + +Cache=0 +; bits, that can't be updated by Z80 and cleared by RESET (decimal value) +; ex: mask=3 - disable HWMC and 512x192, mask=255 - disable all additional hardware + +EFF7mask=0 ; EFF7mask=0 - all pentagon features on +; +SMUC=0 ; enable/disable NVRAM + CMOS RTC +; +RESET=SYS ; may be: BASIC,DOS,MENU,SYS + +ZC=1 ; enable/disable Z-Controller + +HideConsole=0 ; for gui freaks, who annoyed by main console window, set to 1 + +ConfirmExit=0 ; 1 for exit confirmation message + +; help filename +Help=help_eng.html + +; directory with zx-files +DIR=. + +; SPG Memory init: 0 - none, 1 - random data fill, 2 - zero data fill +SPGMemInit=0 + +; Kondrat'yev ISA modem emulated through windows modem on COM-port +; if you own internal PCI modem, use "settings/input" dialog to find out port +Modem=NONE ; NONE or COM1-COM255 + +ZiFi=COM11 ; NONE or COM1-COM255 + +[AUTOLOAD] +; disk images and snapshot, loaded at startup +; file may be compressed, but only one file in archive is allowed + + +diskA=boot.$b +diskB= +diskC= +diskD= +;snapshot=demo1.sna +DefaultDrive=Auto ; Auto, A, B, C, D + + +[INPUT] +; default/bk08/quorum +ZXKeyMap=default +; you can define own layout, naming section in this INI file [ZX.KEYS.myname] +; create layouts for xas/storm/zxasm/alasm/zxword/sts/etc yourself, i'm bored +KeybLayout=default +KeybPCMode=0 ; when enabled, using pc defaults, ex: SHIFT+7 => & +Mouse=KEMPSTON ; mouse type: NONE/KEMPSTON/AY +Wheel=KEMPSTON ; mouse wheel: NONE/KEMPSTON/KEYBOARD +JoyMouse=0 ; emulate kempston joystick on mouse +MouseScale=0 ; logarithmic scale: ZX_mouse=PC_mouse*2^(Scale), valid: [-3;3] +SwapMouse=0 ; swap left and right mouse buttons +KJoystick=1 ; emulate kempston joystick on keyboard and/or gameport +Matrix=1 ; emulate keymatrix effect +Fire=KFIRE ; autofire key -> kempston +FireRate=1 ; autofire button up/down delay (INTs) +AltLock=1 ; does not update ZX-SPECTRUM keyboard while ALT pressed +ATMKBD=0 ; ATM PC/XT keyboard controller +Joy=0 ; Joystick id (0, 1, ...) + +; clipboad paste delays +HoldDelay=2 +ReleaseDelay=5 +NewlineDelay=20 + + +[ULA] +Frame=71680 ; t-states in frame +; Frame=250000 ; t-states in frame - 14MHz +Line=224 ; t-states in line +; Line=784 ; t-states in line - 14MHz +int=50 ; int freq +intstart=13 ; t-states before int +intlen=32 ; int length in t-states +EvenM1=0 ; align M1 cycle to even T-state (for scorpion) +4TBorder=0 ; update border every 4T states (for scorpion) +FloatBus=0 ; unstable data bus +FloatDOS=0 ; unstable data bus in TR-DOS mode +PortFF=0 ; enable/disable port FF + +Preset= ; don't use above settings and load preset + +; PRESET.NAME=FRAME,PAPER,LINE,INT,INTLEN,EvenM1,4TBorder,floatBus,floatDOS,PortFF +PRESET.PENTAGON=71680,13,224,50,32,0,0,0,0,0 +;PRESET.PENTAGON=143360,17989,224,50,32,0,0,0,0,0 +PRESET.SCORPION=69888,14344,224,50,32,1,1,0,0,1 +PRESET.ATM1_2_3.5MHz=69888,17989,224,50,32,0,0,0,0,1 +PRESET.ATM1_2_7.0MHz=99880,17989,224,50,32,0,0,0,0,1 +PRESET.PROFI=69888,12580,224,50,28,0,0,0,0,0 ; thanks to DDp + +; ATM 7.10 hi-res video modes swap RAM/CPU address bus A5-A7<=>A8-A10 +AtmMemSwap=0 +; reprogram color DACs with ATM palette. with this option +; noflic filter works only in fullscreen 16/32-bit, +; colors of system leds are also affected +UsePalette=1 +ProfiMonochrome=0 + +[VIDEO] + +VSync=0 ; enable for slower, but less jerky screen repaint. + ; uses backbuffer - requires twice more video memory + ; WARNING: eats a lot of cpu time! + +FullScr=0 ; start at full-screen. windowed mode can be used only for + ; GDI, Blitter or Overlay video filter / driver + +Refresh=0 ; monitor refresh rate in fullscreen mode (0-default). + ; for video=resampler, the more - the better + +Border=3 ; border size - 0: 256x192, 1: 320x200, 2: 320x240, 3: 360x288, 4: 384x304, 5: 448x320 +NoFlic=0 ; apply noflic filter +AltNoFlic=0 ; use interlaced algorithm for video=double +FlashColor=0 ; + +MinRes=480 ; minimal screen y-resolution in fullscreen mode + ; use 480 or higher to avoid switching mode when entering monitor + ; use 1024 to force 1280x1024 on LCD instead of 1280x960 + + +ChunkSize=auto ; 2,4, or auto-detect (only for ch* videofilters) +PixelScroll=0 ; detect per-pixel scrolling for video=text + + +; frame resampler options: +rsm.frames=4 ; frames to mix (2-8) + +; fir interpolation mode: +; 2C - 12hz cut-off (gigascreen), 3C - 8hz cut-off (3-color) +; FULL - full details (scrollers), SIMPLE - average of last 2 frames +rsm.mode=2C + + +; scale factor for 'video=advmame'. accepted values: 2,3,4 +; 4x scale requires 1280x960 pixels. use border=none, if your monitor displays only 1024x768 +scale=2 + +; window scale factor (for hardware stretching) +winscale=1 + +; video filter/renderer + +video=double + +; values for video filter: +; normal - fastest, but supports only standart spectrum screen, noflic, flash-color and HWMC +; double - slower, but offers better quality and works in: pentagon 512x192, profi 512x240, ... +; triple - 3x picture scale +; quad - 4x picture scale, designed to use in LCD with 1280x1024 to avoid hardware stretching +; use with minres=1024 to avoid 1280x960 mode +; text - converts 4x8 fonts to 8x8 or 8x16 (for reading e-zines) +; resampler - converts spectrum 50hz-int into 60/75/80/... hz display refresh +; bilinear - color interpolation (MMX) +; scale - fake 'vector' scaling +; advmame - 2x,3x,4x scaling algorithm from AdvanceMAME project +; tv - color TV emulation, windowed mode +; ch_ov - chunky (fast), windowed mode (overlay, 16bit) +; ch_hw - chunky (fast), windowed mode (hardware accel, 32bit) +; ch_bl - chunky (filtered,320x240x16) +; ch_b - chunky (filtered,640x480x16) +; ch4true - 32bit 4x4 chunky, full color precision (slow, but no special hardware reqd) + +; driver for video=normal/double/triple/quad/text + +driver=gdi + +; video driver: +; ddraw - direct access to video memory, fullscreen only, fastest +; gdi - standart windows driver (slowest, but most compatible) +; blt - hardware blitter. recommended for accelerated cards (geforce4/etc) +; ovr - video overlay. recommended in windowed mode for slow video cards +; ddrawh, ddrawt - fullscreen 16- and 32-bit modes + +fastlines=0 ; for video=double - draw twice faster in expense of visual quality + ; for video=anti64 - 4x8->8x8, else 4x8->8x16 + +; use overlay is faster, but you'll get wrong colors if videocard can't +; use RGB555/RGB565 pixels formats for overlay (such as all nVidia cards) +; some video cards do interpolation in overlay mode, +; even if we don't requested it + +ScanIntens=100;45 ; (%) bright for scan lines when video=double,fastlines=0 + ; only for true-color and high-color modes + ; 8-bit modes use palette values ZN,ZB + +; ignore these filters +Hide= ;ch_bl,ch_ov,ch4true + +; update border for CPU expensive filters +Update=1 +; how much frames to skip before displaying frame (for PCI video set to 2) +SkipFrame=0 +; don't wastetime on drawing when running on max speed +SkipFrameMaxSpeed=64 +; screenshot format: SCR, BMP, PNG +ScrShot=PNG +; screenshot directory. +ScrShotDir=. +; when enabled, displays videocard vendor id, device id, card name +; (warning: sometimes uses driver database at http://crl.microsoft.com !!!) +; when disabled, faster startup but no additional information +DetectModel=0 + +; apply filter for 1x2 Atari chunks. situable for games, converted from XL, +; like SpyVsSpy, Flying Shark. presets for games defined in [COLORS] section +; (for now, filter works in 8-bit and 16-bit-normal /not-double/ modes) +;AtariPreset=fl_shark_red_palette +AtariPreset=none + +; ffmpeg settings +; exec: path and name of ffmpeg executable (without quotes) +; newconsole: 1 - open new console for ffmpeg output, +; 0 - print ffmpeg output into emul's console (useful for debug) +; parm: encoding settings (see ffmpeg doc) +; vout: output video file name (use '#' sign for sequence number substitution) +ffmpeg.exec=ffmpeg.exe +ffmpeg.newconsole=1 + +; ffmpeg encoding options +; -ss 00:00:00.500 - skip first 500 ms (skip 25 frames with status line) +; -af volume=3.0 - gain sound volume by 3 +; -vf "..." - apply video filter +; -r 25 - set 25 fps +; -c:a ... - set audio codec ("copy" for uncompressed wav) +; -c:v ... - set video codec ("copy" for uncompressed rgb24) +; -b:a 320k - set bitrate for audio +; -b:v 2800k - set bitrate for video + +;# mp3:320kbps, x264:baseline,10, fast +ffmpeg.parm=-c:a libmp3lame -b:a 320k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -ss 00:00:00.500 +ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:baseline,10, fast +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:baseline,10, slow +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryslow -profile:v baseline -crf 10 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:lossless, fast +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt rgb24 -preset:v ultrafast -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:lossless, slow +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt rgb24 -preset:v veryslow -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# wav, x264:lossless, fast +;ffmpeg.parm=-c:a copy -c:v libx264 -pix_fmt yuvj420p -preset:v ultrafast -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# wav, x264:lossless, slow +;ffmpeg.parm=-c:a copy -c:v libx264 -pix_fmt yuvj420p -preset:v veryslow -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# uncompressed +;ffmpeg.parm=-c:a copy -c:v copy -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# Image sequence: PNG +;ffmpeg.parm= +;ffmpeg.vout=video#_%06d.png + +;# PAL DVD video +; MUST use picture size greater than 720x576 (for example, DOUBLE SIZE and COMPLETE border)! +;ffmpeg.parm=-af volume=3.000000 -bf 2 -vf "crop=720:576,tinterlace=mode=interlacex2" -aspect 4:3 -target pal-dvd -r 25 -b:v 2800k -ss 00:00:00.500 +;ffmpeg.vout=video#.mpg + +;# PAL DVD video +; MUST use picture size lower than 720x576 (and DOUBLE SIZE for correct interlace)! +;ffmpeg.parm=-af volume=3.000000 -bf 2 -vf "pad=720:576:(ow-iw)/2:(oh-ih)/2,tinterlace=mode=interlacex2" -aspect 4:3 -target pal-dvd -r 25 -b:v 2800k -ss 00:00:00.500 +;ffmpeg.vout=video#.mpg + +;# RTMP streaming: justin.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -f flv +;ffmpeg.vout=rtmp://live.justin.tv/app/live_74829844_mfrdpoeg034tn03gn03ring3f0rngc + +;# RTMP streaming: own3d.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -f flv +;ffmpeg.vout=rtmp://live.eu.own3d.tv/live/b8493921_949585_kjhb5632l3l1 + +;# RTMP streaming: twitch.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -bufsize 1835k -f flv +;ffmpeg.vout=rtmp://live.justin.tv/app/live_sub_5b8ed4fae83fe83e920227337beab7e73b7a3ba3 + +[BETA128] +Beta128=1 +Noise=1 ; seek noise +Traps=1 ; intercept sector save/load routines in TR-DOS ROM for faster loading +Fast=1 ; disable all FDD/FDC delays. some programs will not work +IL=1 ; sector interleave (1=1:1, 2=2:1, 3=3:1) applied when loading TRD/SCL + ; if you prefer fast=0, set to 2 for 3d13 loaders, to 1 for turbo-loaders +BOOT=boot.$b + +[SOUND] +SoundFilter=0 ; lowpass filter (good for beeper) +SoundDrv=ds ; wave, ds or none +RejectDC=1 ; reject DC component of output sound + +; sound buffer size for SoundDrv=wave +; the more buffer, the more delay before sound playing... +; if sound is jerky, try SoundBuffer=16 +; for really fast computers with windows 2000, try SoundBuffer=4 +SoundBuffer=auto;10 ; only for SoundDrv=wave + +DSPrimary=0;1 ; use primary buffer for DSound. no sound in background. + ; useful only for troubleshooting + + +; when [SOUND] Enabled=0, emulator runs on maximum speed +Enabled=1 + +Fq=44100 ; check maximum sampling rate in your soundcard manual + ; setting freq not supported by hardware + ; will cause resampling and degrade quality and performance + +GSType=BASS ; BASS, Z80 or NONE +GSReset=1 ; reinit GS on reset + +SD=1 ; enable/disable soundrive +CovoxFB=1 ; enable/disable pentagon covox +CovoxDD=1 ; enable/disable scorpion covox + +Saa1099=0 ; enable/disable saa1099 +MoonSound=1 ; enable/disable moonsound + +; max sound volume is 8192. set to 0 to completely disable sound device +BeeperVol=8192 ; most popular sound device +MicOutVol=1000 ; tape saving +MicInVol=1000 ; tape loading +AYVol=8192 ; volume of each channel +CovoxFBVol=8192 ; pentagon covox +CovoxDDVol=6000 ; scorpion covox +CovoxProfiVol=6000 ; profi covox +SDVol=4000 ; soundrive +GSVol=8000 ; general sound (for both high- and low- level emulation modes) +BASSVol=8000 ; MOD-player of BASS.DLL +MoonSoundVol=8000 ; ZXM-MoonSound + +[NGS] ; neo gs settings +RamSize=2048 ; ngs ram size 2048, 4096 + +[ZC] ; Z-Controller settings +; sdcard image +SDCARD=wc.img +SDDelay=1500 ; delay before data token, T-states 3.5MHz + +[SAA1099] +FQ=8000000 + +[AY] +Chip=YM2203 ; bus reaction (none/AY/YM/YM2203) +FQ=1774400 ; chip clock fq +Stereo=ABC ; AY stereo mode - any of STEREO.* +VolTab=default.YM ; volume table - any of VOLTAB.* +UseSamples=0 ; 0 - square tones, 1 - digital samples (low quality) +; double-AY scheme: +; none - no soundchip +; default - single AY/YM +; PSEUDO - pseudo-turbo (one port for two devices + some phase shift) +; QUADRO - pentagon 2nd AY on #AFFD,#EFFD +; POS - power of sound turbo-AY (bit 0 of port #1F) +; CHRV - NedoPC turbo-sound (switch chip on selection reg #FE/FF) +Scheme=CHRV + + +; STEREO.PRESET_NAME=A_left,A_right,B_left,B_right,C_left,C_right +; (you can define your custom presets, all numbers are from [0; 100]) +STEREO.ABC=100,10,66,66,10,100 +STEREO.ACB=100,10,10,100,66,66 +STEREO.BAC=66,66,100,10,10,100 +STEREO.mono=66,66,66,66,66,66 +STEREO.unreal=90,20,66,66,20,90 + +; volume tables +VOLTAB.default.AY=0000,0340,04C0,06F2,0A44,0F13,1510,227E,289F,414E,5B21,7258,905E,B550,D7A0,FFFF +VOLTAB.default.YM=0000,0000,00EF,01D0,0290,032A,03EE,04D2,0611,0782,0912,0A36,0C31,0EB6,1130,13A0,1751,1BF5,20E2,2594,2CA1,357F,3E45,475E,5502,6620,7730,8844,A1D2,C102,E0A2,FFFF +VOLTAB.BULBA_OPEN.AY=0000,1111,2222,3333,4444,5555,6666,7777,8888,9999,AAAA,BBBB,CCCC,DDDD,EEEE,FFFF +VOLTAB.BULBA_OPEN.YM=0000,0000,041A,08D4,11A8,1A7B,234F,2C23,34F7,3DCB,469F,4F72,5846,611A,69EE,72C2,7B96,8469,8D3D,9611,9EE5,A7B9,B08D,B960,C234,CB08,D3DB,DCB0,E584,EE57,F72B,FFFF +VOLTAB.DELPHISPEC=0136,0170,01B5,0208,026A,02DF,0369,040E,04D2,05BB,06CF,0818,099F,0B6F,0D97,1026,1332,16D0,1B1D,203A,264D,2D85,361A,404D,4C6C,5AD4,6BF3,804D,987C,B53B,D764,FFFF +VOLTAB.X128=0000,0200,0500,0700,0A00,0C00,1200,1600,1D00,2200,2600,2C00,3F00,3F00,3F00,FF00 +VOLTAB.YASE=0000,0200,0500,0700,0A00,0C00,1200,1600,1D00,2200,2600,2C00,3F00,3F00,3F00,FF00 +VOLTAB.ZXMAK=0000,0000,00F8,01C2,029E,033A,03F2,04D7,0610,077F,090A,0A42,0C3B,0EC2,1137,13A7,1750,1BF9,20DF,2596,2C9D,3579,3E55,4768,54FF,6624,773B,883F,A1DA,C0FC,E094,FFFF +;original Lion17.YM=0000,0156,0228,033A,0502,086F,0CD4,17B9,1AF0,2E8D,4047,4F47,6528,7B19,92E1,AAAA +;original Lion17.AY=0000,0014,007F,00BF,00FA,0139,0175,01BB,0241,02F1,03F2,04B2,05DE,076B,08BA,0A0F +VOLTAB.Lion17.YM=0000,0201,033C,04D7,0783,0CA6,133E,2395,2868,45D3,606A,76EA,97BC,B8A5,DC51,FFFF +VOLTAB.Lion17.AY=0000,01FD,0CA0,12FD,18DA,1F1E,2515,2C0A,395C,4ADC,6468,777F,9552,BCCA,DE18,FFFF +;original Vaggelis Kapartzianis=00,03,04,05,06,07,08,0A,0C,0E,11,15,19,1D,23,2A +VOLTAB.Vaggelis Kapartzianis=0000,1249,1861,1E79,2492,2AAA,30C2,3CF3,4924,5555,679E,7FFF,9860,B0C2,D554,FFFF +VOLTAB.RAMSOFT.AY=0000,0364,0500,0700,0A80,1000,1600,2300,2A00,4300,5C00,7300,9180,B400,D800,FFFF +VOLTAB.RAMSOFT.YM=0000,0000,00F8,01C2,029E,033A,03F2,04D7,0610,077F,090A,0A42,0C3B,0EC2,1137,13A7,1750,1BF9,20DF,2596,2C9D,3579,3E55,4768,54FF,6624,773B,883F,A1DA,C0FC,E094,FFFF +VOLTAB.R80=0000,0201,033C,04D7,0783,0CA6,133E,2396,2868,45D4,606A,76EA,97BC,B8A6,DC52,FFFF + +[COLORS] +color=default + +; palette format: +; name=ZZ,ZN,NN,NB,BB,ZB:R11,R12,R13;R21;R22;R23;R31;R32;R33 +; where ZZ,NN,BB - bright levels for black,normal,and bright colors +; ZN,NB,ZB - bright levels for zero+normal, normal+bright, zero+bright +; for GIGASCREEN and FLASH-COLORS +; Rnn - matrix for post-processing: +; real_Red = (Red*R11 + Green*R12 + Blue*R13) / 0x100 +; real_Green = (Red*R21 + Green*R22 + Blue*R23) / 0x100 +; real_Blue = (Red*R31 + Green*R32 + Blue*R33) / 0x100 +; +; note: emulator uses 8-bit precision for color components, +; 8-bit filters: use 6 bit precision (VGA palette limitation) +; overlay & hi-color: truncates results to 5 bit +; true color: no quality loss +; +; R, G, B - 0..0xFF +; R11..R33 - 0..0x100 +; palette settings does not affect chunky modes +; +; default=00,80,C0,E0,FF,C8:100,00,00;00,100,00;00,00,100 + +Mars=00,80,C0,E0,FF,C8:100,00,00;40,C0,00;00,40,C0 +Ocean=20,80,A0,C0,E0,A8:D0,00,30;00,D0,30;00,00,100 +Grey=00,80,C0,E0,FF,C8:49,92,24;49,92,24;49,92,24 +alone=00,60,A0,E0,FF,A0:100,00,00;00,100,00;00,00,100 +pulsar=00,76,CD,E9,FF,9F:100,00,00;00,100,00;00,00,100 +ATM=00,55,AA,E0,FF,80:100,00,00;00,100,00;00,00,100 + +; presets for atari-like mode +; format: : [ , : ]* +; color is a mix of 2 pure spectrum colors, e.g. 11=red+red=red, 47=green+white=light-green, etc... +atari.fl_shark_red_palette=06:EE666600 +atari.test=70:00132177,0F:001199FF,34:33119944 + + +[HDD] +Scheme=NEMO-DIVIDE ; interface type: NONE/ATM/NEMO/NEMO-A8/NEMO-DIVIDE/SMUC/PROFI/DIVIDE +SkipReal=1 ; disable work with physical drives. faster startup when + ; you have no connected spectrum drive(s) + +CDROM=;ASPI;SPTI ; SPTI (native WinNT) or ASPI (use 3rd-party library wnaspi32.dll) + +; for image file, specify filename with full path, else it'll not work + +; master device. specify image filename or to use real drive +Image0=wc.img +CHS0=1572/16/63 ; max size, accessible through CHS. not used for real drive +LBA0=0 ; max size, accessible through LBA. not used for real drive +HD0RO=0 ; read only flag +CD0=0 ; 1 if image is cdrom + +; slave device. empty filename used for disconnected device +Image1= +;<_NEC CD-RW NR-7800B> +; +CHS1=1937/16/63 +LBA1=1950720 +HD1RO=0 +CD1=1 ; 1 if image is cdrom + +[ROM] +; general sound firmware +GS=rom\bootgs.rom +; moonsound wavetable +MOONSOUND=rom\YRW801-M - Yamaha - 1993.rom + + +; 64/128/512/1024K ROM images (single file) + +PENTAGON=rom\pentagon.rom + +ATM1=rom\atm1.rom + +;ATM2=Xbios103.rom +ATM2=rom\atm2.rom + +ATM3=rom\zxevo.rom + +; standard PROFI 64K rom +PROFI=rom\profi.rom + +; standard scorpion 64K rom +SCORP=rom\scorpion.rom + +; for SMUC 512k ROM, use file.rom:0 and file.rom:1 to select active bank +PROFROM=rom\scorp_prof401.ROM:0 + +; standard GMX 512K rom +GMX=rom\gmx.rom + +; standard KAY 64K rom +KAY=rom\kay1024.rom + +; TS-config +TSL=rom\zxevo.rom + +; LSY256 +LSY=rom\lsy256.rom + +; ZXM-Phoenix +PHOENIX=rom\ZXM-Phoenix_bios.bin + +; you can create own 64K-ROMSET, naming ini section [ROM.my_own_set] +; for empty ROMSET, single-file large ROM used (accordingly to memory model) +ROMSET= + +[ROM.default] +title=Separate ROMs set +; service rom [optional] +sys=rom\glukpen.rom +; basic48 - high 16K of sinclair rom [required!] +sos=rom\2006.rom +; tr-dos [optional] +dos=rom\dos6_10e.rom +; basic128 - low 16K of sinclair rom [optional] +128=rom\qc_3_05.rom + +[ROM.pentagon] +title=Pentagon-128 + TR-DOS +128=rom\128_low.rom +sos=rom\48for128.rom +dos=rom\trdos504t.ROM +sys=rom\service.rom + +[ROM.GLUK] +title=Mr Gluk Reset Service +128=rom\128.rom +sos=rom\48.rom +dos=rom\dos6_10e.rom +sys=rom\glukpen.rom + +[ROM.scorpion] +title=Scorpion (64K,v2.92) +128=rom\scorpion.rom:0 +sos=rom\scorpion.rom:1 +sys=rom\scorpion.rom:2 +dos=rom\scorpion.rom:3 + +[ROM.profi] +title=PROFI (64k) +sys=rom\profi.rom:0 +dos=rom\profi.rom:1 +128=rom\profi.rom:2 +sos=rom\profi.rom:3 + +[ROM.KAY] +title=KAY (64k) +128=rom\kay1024s.rom:0 +sos=rom\kay1024s.rom:1 +sys=rom\kay1024s.rom:2 +dos=rom\kay1024s.rom:3 + +[ROM.48K] +title=ZX-Spectrum 48K +sos=rom\48.rom + +[ROM.128K] +title=ZX-Spectrum 128K +128=rom\128.rom:0 +sos=rom\128.rom:1 + +[ROM.ATM1] +title=ATM1 +sos=rom\atm1.rom:0 +dos=rom\atm1.rom:1 +128=rom\atm1.rom:2 +sys=rom\atm1.rom:3 + +[ROM.ATM2] +title=ATM2 +sos=rom\atm2.rom:0 +dos=rom\atm2.rom:1 +128=rom\atm2.rom:2 +sys=rom\atm2.rom:3 + +[ROM.ATM3] +title=ATM3 +sos=rom\zxevo.rom:0 +dos=rom\zxevo.rom:13 +128=rom\zxevo.rom:2 +sys=rom\zxevo.rom:3 + +[LEDS] +; enable leds +leds=1 +; ay amplitude peaks on keyboard leds +KBD_AY=0 + +; led coordinates in pixels. comment out, if you don't want some led +; negative coordinates are offset from bottom and right +; WARNING! if you choose coordinates outside visible screen area +; emulator will crash + +; AY volumes. color indicates noise, envelope or digital sound use +AY=1:1,1 +; show Z80 t-states between HALTs and PC framerate +Perf=1:1,-11 +PerfShowT=0 ; display used CPU t-states + +; GS/TRDOS/TAPE read/write +LOAD=1:-24,1 +; active input devices: keyboard, mouse, kempston +Input=1:20,1 +; local time +Time=1:-32,-10 +; on-screen watches (debugger) +OSW=0:-50,26 +; zx-spectrum memory in dynamic: read/write/execute +MemBand=0:60,3 +; bytes per pixel in memory band (allowed 64,128,256,512) +BandBpp=256 + +[ARC] +; these files are ignored +SkipFiles=*.nfo;*.txt;*.diz;*.inf;files.bbs;descript.ion + +; you may add your own archivers! + +; command line to extract all files without pathnames and without +; queries on overwrite, use %s to indicate archive filename; +; use archivers, that understand long filenames! +CAB=extrac32 /E /Y "%s" +ZIP=pkzip25 -extract=all -overwrite=all "%s" +ZIP=pkunzip -o -Jahrs %s +ZIP=pkunzip -o %s +ZIP=pkunzip %s +RAR=rar32 e -y "%s" +RAR=rar e -y "%s" + +[SYSTEM.KEYS] + +; pc keyboard: +; +; ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRSCR SCLOCK PAUSE +; TIL 1 2 3 4 5 6 7 8 9 0 MINUS PLUS BACK INS HOME PGUP NUMLOCK GRDIV GRMUL GRSUB +; TAB Q W E R T Y U I O P LB RB DEL END PGDN N7 N8 N9 GRADD +; CAPS A S D F G H J K L COL QUOTE ENTER N4 N5 N6 +; LSHIFT Z X C V B N M COMMA POINT SLASH RSHIFT BACKSL UP N1 N2 N3 GRENTER +; LCONTROL LALT SPACE RALT MENU RCONTROL LEFT DOWN RIGHT N0 NP + +; LMB,RMB,MMB - mouse buttons +; MWU,MWD - mouse wheel up/down +; JLEFT,JRIGHT,JUP,JDOWN,JFIRE - joystick/gamepad +; JB0..JB31 - joystick/gamepad buttons + +; mouse & joystick "keys" can't be bound to commands, only to spectrum keys + +; p.s. +; CONTROL = LCONTROL or RCONTROL +; ALT = LALT or RALT +; SHIFT = LSHIFT or RSHIFT +; numlock must be on for N0-N9 and NP + +; system commands: +; command=key1 [key2 [key3 [key4]]] + +; keys active in emulation mode + +main.exit=ALT F4 ; why do this? +main.lockmouse=SHIFT ESC ; read kempston mouse in windowed mode +main.monitor=TIL ; for hackers only +main.selectfilter=F4 ; select video filter +main.selectdriver=SHIFT F4 ; select video driver for some filters +main.fullscreen=ALT ENTER ; toggle full-screen on/off +main.pause=PAUSE ; pause +main.selectfix=GRMUL ; select video parameter +main.selectsnd=ALT GRMUL ; select soundchip parameter or palette +main.incfix=SHIFT GRADD ; fine tuneup +main.decfix=SHIFT GRSUB ; fine tuneup +main.incfix10=GRADD ; tuneup +main.decfix10=GRSUB ; tuneup +main.leds=GRDIV ; leds on/off +main.maxspeed=NUMLOCK ; max speed on/off +main.pokedialog=F6 ; enter poke(s) +main.starttape=F7 ; start/stop tape +main.tapebrowser=SHIFT F7 ; tape browser +main.screenshot=ALT F8 ; screenshot +main.savevideo=CONTROL F8 ; save video +main.reset=F12 ; reset to [MISC]Reset=DOS/BASIC/MENU/SYS +main.reset128=CONTROL SHIFT F12 ; reset to basic 128 +main.resetsys=SHIFT F12 ; reset to service ROM +main.reset48=ALT SHIFT F12 ; reset to basic 48 with locked 128k memory +main.resetbasic=ALT F12 ; reset to basic 48 with unlocked 128k memory +main.resetdos=CONTROL F12 ; reset to TR-DOS +main.resetcache=ALT CONTROL F12 ; reset to cache +main.nmi=F11 ;ALT SHIFT F11 ; NMI without ROM switching +main.nmidos=CONTROL F11 ; TR-DOS magic +main.nmicache=ALT F11 ; NMI in cache +main.help=F1 ; show keys +main.settings=ALT F1 ; emulation settings (GUI) +main.save=F2 ; save disk/snapshot +main.load=F3 ; load disk/tape/snapshot +main.savesound=F5 ; save WAV/VTX +main.qsave1=ALT F2 ; quick save to qsave1.sna +main.qsave2=CONTROL F2 ; quick save to qsave2.sna +main.qsave3=SHIFT F2 ; quick save to qsave3.sna +main.qload1=ALT F3 ; quick load from qsave1.sna +main.qload2=CONTROL F3 ; quick load from qsave2.sna +main.qload3=SHIFT F3 ; quick load from qsave3.sna +main.keystick=SCLOCK ; toggle keystick mode +main.autofire=ALT NUMLOCK ; toggle autofire mode +main.saveall=F9 ; quick save cmos and disks +main.xtkbd=ALT CONTROL Z ; enable/disable ATM XT keyboard (emulation controls blocked!) +main.pastetext=ALT SHIFT INS ; copy text from clipboard to keyboard buffer +main.size1=ALT 1 ; set normal window size (in windowed mode) +main.size2=ALT 2 ; set double window size (in windowed mode) +main.sizem=ALT 3 ; maximize window (in windowed mode) +main.memsearch=ALT F6 ; search in memory for changed values (cheats, etc) +main.savevideo=CONTROL F8 ; save video + +; keys in all monitor windows + +mon.cpu=CONTROL TIL ; switch to next cpu +mon.exit=ALT F4 ; +mon.emul=TIL ; back to emulation +mon.bpdialog=ALT C ; conditional breakpoints dialog +mon.gs=ALT G ; gs status dialog +mon.pokedialog=ALT P ; enter poke(s) F6 is already used +mon.tapebrowser=SHIFT F7 ; tape browser +mon.reset=F12 ; reset to [MISC]Reset=DOS/BASIC/MENU/SYS +mon.reset128=CONTROL SHIFT F12 ; reset to basic 128 +mon.resetsys=ALT F12 ; reset to service ROM +mon.reset48=ALT SHIFT F12 ; reset to basic 48 with locked 128k memory +mon.resetbasic=SHIFT F12 ; reset to basic 48 with unlocked 128k memory +mon.resetdos=CONTROL F12 ; reset to TR-DOS +mon.resetcache=ALT CONTROL F12 ; reset to cache +mon.nmi=ALT SHIFT F11 ; NMI without ROM switching +mon.nmidos=CONTROL F11 ; TR-DOS magic +mon.nmicache=ALT F11 ; NMI in cache +mon.help=F1 ; show keys +mon.settings=ALT F1 ; emulation settings (GUI) +mon.save=F2 ; save disk/snapshot +mon.load=F3 ; load disk/tape/snapshot +mon.savesound=F5 ; save WAV/VTX +mon.qsave1=ALT F2 ; quick save to qsave1.sna +mon.qsave2=CONTROL F2 ; quick save to qsave2.sna +mon.qsave3=SHIFT F2 ; quick save to qsave3.sna +mon.qload1=ALT F3 ; quick load from qsave1.sna +mon.qload2=CONTROL F3 ; quick load from qsave2.sna +mon.qload3=SHIFT F3 ; quick load from qsave3.sna +mon.setrange=F6 ; set range of breakpoints +mon.resetrange=SHIFT F6 ; reset range of breakpoints +mon.screen=F9 ; show screen, as it present in video memory +mon.altscreen=SHIFT F9 ; show inactive screen +mon.rayscreen=ALT F9 ; show painted screen area until crt-ray (with MC, border & 2-scr effects) +mon.step=F7 ; single step +mon.stepover=F8 ; step over loops and calls +mon.exitsub=F11 ; trace until (sp) +mon.loadblock=ALT R ; load memory block +mon.saveblock=ALT W ; save memory block +mon.fillblock=ALT F ; fill memory block with pattern +mon.setbank=ALT B ; write to #7FFD +mon.sethimem=ALT M ; write to model-specific extended memory port +mon.next=TAB ; next window +mon.prev=SHIFT TAB ; prev window +mon.dump=ALT D ; toggle dump +mon.rip=ALT T ; ripper's tool +mon.osw=ALT O ; setup on-screen watches +mon.scrshot=ALT S ; toggle screenshot/scrdump/watches +mon.setwatch=CONTROL U ; set user-defined watch address +mon.switchay=ALT Y ; switch active AY (turbo-sound) +mon.labels=CONTROL J ; goto label +mon.memsearch=ALT F6 ; search in memory for changed values (cheats, etc) +mon.switchdump=CONTROL D ; CMOS/NVRAM editor + +; keys in registers window + +reg.left=LEFT ; select register +reg.right=RIGHT ; select register +reg.up=UP ; select register +reg.down=DOWN ; select register +reg.edit=ENTER ; edit current register +reg.a=CONTROL A ; edit A +reg.f=CONTROL F ; edit flags +reg.bc=CONTROL B ; edit BC +reg.de=CONTROL D ; edit DE +reg.hl=H ; edit HL +reg.pc=P ; edit PC +reg.sp=S ; edit SP +reg.ix=X ; edit IX +reg.iy=Y ; edit IY +reg.i=I ; edit i +reg.r=R ; edit R +reg.im=M ; edit im +reg.iff1=CONTROL 1 ; edit iff1 +reg.iff2=CONTROL 2 ; edit iff2 +reg.SF=ALT S ; toggle SF +reg.ZF=ALT Z ; toggle ZF +reg.F5=ALT 5 ; toggle F5 +reg.HF=ALT H ; toggle HF +reg.F3=ALT 3 ; toggle F3 +reg.PF=ALT P ; toggle PF/PV +reg.NF=ALT N ; toggle NF +reg.CF=ALT C ; toggle CF +reg.codejump=QUOTE ; goto address in code window under cursor +reg.datajump=COL ; goto address in data window under cursor + +; keys in cpu window + +cpu.findpc=HOME ; set cursor at PC +cpu.here=F4 ; trace to cursor +cpu.findtext=ALT F7 ; find string +cpu.findcode=CONTROL F7 ; find code with mask +cpu.goto=G ; goto address +cpu.bpx=SPACE ; breakpoint under cursor +cpu.asm=ENTER ; edit instruction +cpu.setpc=Z ; set PC to cursor +cpu.up=UP ; move cursor up +;cpu.up=MWU ; move cursor up +cpu.down=DOWN ; move cursor down +;cpu.down=MWD ; move cursor down +cpu.left=LEFT ; move cursor left +cpu.right=RIGHT ; move cursor right +cpu.pgdn=PGDN ; next page +cpu.pgup=PGUP ; prev page +cpu.save1=CONTROL 1 ; save cursor position to slot 1 +cpu.save2=CONTROL 2 +cpu.save3=CONTROL 3 +cpu.save4=CONTROL 4 +cpu.save5=CONTROL 5 +cpu.save6=CONTROL 6 +cpu.save7=CONTROL 7 +cpu.save8=CONTROL 8 +cpu.rest1=1 ; save cursor position to jumpstack, load from slot 1 +cpu.rest2=2 +cpu.rest3=3 +cpu.rest4=4 +cpu.rest5=5 +cpu.rest6=6 +cpu.rest7=7 +cpu.rest8=8 +cpu.back=BACK ; pop cursor position from jumpstack +cpu.context=QUOTE ; push cursor position and goto instruction operand +cpu.datajump=COL ; jump to instruction operand in data window +cpu.labels=CONTROL L ; show labels on/off +cpu.importl=CONTROL A ; menu for importing labels from XAS/ALASM + +; keys in memory dump window + +mem.left=LEFT ; cursor left +mem.right=RIGHT ; cursor right +mem.up=UP ; cursor up +mem.down=DOWN ; cursor down +mem.pgup=PGUP ; page up +mem.pgdn=PGDN ; page down +mem.switch=CONTROL TAB ; move to hex/ascii +mem.stline=HOME ; start of line +mem.endline=END ; end of line +mem.findtext=ALT F7 ; find text in memory / disk track +mem.findcode=CONTROL F7 ; find code with mask in memory / disk track +mem.goto=CONTROL G ; goto address +mem.mem=CONTROL M ; select memory editor +mem.diskphys=CONTROL V ; select disk editor (physical track) +mem.disklog=CONTROL O ; select disk editor (logical sectors) +mem.diskgo=CONTROL T ; select drive/track/sector in diskeditor +mem.pc=CONTROL P ; goto PC +mem.sp=CONTROL S ; goto SP +mem.bc=CONTROL B ; goto BC +mem.de=CONTROL D ; goto DE +mem.hl=CONTROL H ; goto HL +mem.ix=CONTROL X ; goto IX +mem.iy=CONTROL Y ; goto IY + + + +[ZX.KEYS.default] + +Name=unreal default + +; ZX keyboard layout: +; +; 1 2 3 4 5 6 7 8 9 0 +; Q W E R T Y U I O P +; A S D F G H J K L ENT +; CAP Z X C V B N M SYM SPC + +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick + +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM K +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM Z +TAB=CAP SPC ; break +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM CAP + +LSHIFT=CAP +RSHIFT=SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT + +MWU=CAP 7 +MWD=CAP 6 + +JLEFT=KLEFT +JRIGHT=KRIGHT +JUP=KUP +JDOWN=KDOWN +JFIRE=KFIRE + +[ZX.KEYS.XAS] + +Name=XAS 7.xx (incomplete) + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +SHIFT=CAP +CONTROL=SYM + +[ZX.KEYS.ACEDIT] + +; layout created by Alone Coder + +Name=ACEdit + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM L +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM O +TAB=SYM CAP +ESC=CAP SPC +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM Z + +SHIFT=CAP +CONTROL=SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT +GRSUB=SYM J +GRADD=SYM K +GRMUL=SYM B +GRDIV=SYM V + +[ZX.KEYS.Z80Stealth] + +Name=Z80Stealth default + +; ZX keyboard layout: +; +; 1 2 3 4 5 6 7 8 9 0 +; Q W E R T Y U I O P +; A S D F G H J K L ENT +; CAP Z X C V B N M SYM SPC + +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick + +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM K +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM Z +TAB=CAP SPC ; break +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM CAP + +RALT=SYM +LSHIFT=CAP +RSHIFT=CAP +RCONTROL=CAP SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT + +MWU=CAP 7 +MWD=CAP 6 + +JLEFT=KLEFT +JRIGHT=KRIGHT +JUP=KUP +JDOWN=KDOWN +JFIRE=KFIRE + +[ZX.KEYS.quorum] +Name=Quorum + +; Quorum keyboard layout: +; +; F1 F2 F3 F4 F5 [G] NMI INV [< RES +; [E] 1 2 3 4 5 6 7 8 9 0 - + BS DEL NSLASH NSTAR NMINUS +; TAB Q W E R T Y U I O P [ ] \ N7 N8 N9 +; CAPS A S D F G H J K L ; ' ~ ENT N4 N5 N6 +; RUS LAT Z X C V B N M , . / UP N1 N2 N3 +; CAP FIRE SPC SYM LT DN RT N0 NPOINT NPLUS +; +; FIRE,LT,DN,RT,UP=0,5,6,8,7 +; NMI,RES=F11,F12(see main.*) +; INV,[< - NOT emulated +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick +; (JLEFT,JRIGHT,JUP,JDOWN,JFIRE reserved for joystick) +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +ESC=EBOX +DEL=BS +TIL=TILDA +CAPS=CAPS +LEFT=5 +DOWN=6 +UP=7 +RIGHT=8 +BACK=DEL +MINUS=- +PLUS=+ +COMMA=, +POINT=. +ENTER=ENT +SPACE=SPC +LB=[ +RB=] +COL=COLON +TAB=TAB +;HOME=N7 +;END=N1 +;PGUP=N8 +;PGDN=N2 +N1=N1 +N2=N2 +N3=N3 +N4=N4 +N5=N5 +N6=N6 +N7=N7 +N8=N8 +N9=N9 +N0=N0 +NP=NPOINT +QUOTE=QUOTE +SLASH=/ +BACKSL=\ +F1=F1 +F2=F2 +F3=F3 +F4=F4 +F5=F5 +F6=GBOX +GRDIV=NSLASH +GRMUL=NSTAR +GRSUB=NMINUS +GRADD=NPLUS +PGUP=RUS +PGDN=LAT + +LSHIFT=CAP +RSHIFT=SYM + +;N4=KLEFT +;N6=KRIGHT +;N8=KUP +;N2=KDOWN +;N5=KFIRE +;N1=KLEFT KDOWN +;N3=KRIGHT KDOWN +;N7=KUP KLEFT +;N9=KUP KRIGHT diff --git a/_esp/Unreal2/Unreal.exe b/_esp/Unreal2/Unreal.exe new file mode 100644 index 0000000..65db807 Binary files /dev/null and b/_esp/Unreal2/Unreal.exe differ diff --git a/_esp/Unreal2/Unreal.ini b/_esp/Unreal2/Unreal.ini new file mode 100644 index 0000000..92ca80b --- /dev/null +++ b/_esp/Unreal2/Unreal.ini @@ -0,0 +1,1353 @@ +[*] unreal speccy configuration file + +UNREAL=0.37.9 ; make sure you don't have old INI version + +[MISC] +; give idle timeslices to other applications +ShareCPU=1 ; 1 - only for fast CPUs (incompatible with SoundDrv=none) +; +HighPriority=1 ; boost process priority, disabled on ShareCPU=0 +; +; high memory: PENTAGON, SCORPION, PROFSCORP, GMX, PROFI, ATM450, ATM710, KAY, ATM3, TSL, LSY +HIMEM=TSL +; memory size, KB +RAMSize=4096 + +; ULA+: NONE, TYPE1 (Blue is 000 011 101 111), TYPE2 (Blue is 000 011 100 111) +ULAPLUS=TYPE1 + +; ZX-Evo Video DAC resolution: NONE, 3BIT, 4BIT, 5BIT +TS_VDAC=5BIT + +; OUT (C), 0 value +OUT_C_0=0 + +; KR1858VM1 halt handling +Z80_VM1=0 + +TapeTraps=1 +; start tape on ROM load routine + +TapeAutoStart=1 +; cmos on DFF7/BFF7: none, DALLAS (pc chip), or 512Bu1 (russian chip) + +CMOS=DALLAS +; cache size: 16,32 or 0 - disabled. no effect for ATM-4.50 model + +Cache=0 +; bits, that can't be updated by Z80 and cleared by RESET (decimal value) +; ex: mask=3 - disable HWMC and 512x192, mask=255 - disable all additional hardware + +EFF7mask=0 ; EFF7mask=0 - all pentagon features on +; +SMUC=0 ; enable/disable NVRAM + CMOS RTC +; +RESET=SYS ; may be: BASIC,DOS,MENU,SYS + +ZC=1 ; enable/disable Z-Controller + +HideConsole=0 ; for gui freaks, who annoyed by main console window, set to 1 + +ConfirmExit=0 ; 1 for exit confirmation message + +; help filename +Help=help_eng.html + +; directory with zx-files +DIR=. + +; SPG Memory init: 0 - none, 1 - random data fill, 2 - zero data fill +SPGMemInit=0 + +; Kondrat'yev ISA modem emulated through windows modem on COM-port +; if you own internal PCI modem, use "settings/input" dialog to find out port +Modem=NONE ; NONE or COM1-COM255 + +ZiFi=COM11 ; NONE or COM1-COM255 + +[AUTOLOAD] +; disk images and snapshot, loaded at startup +; file may be compressed, but only one file in archive is allowed + + +diskA=boot.$b +diskB= +diskC= +diskD= +;snapshot=demo1.sna +DefaultDrive=Auto ; Auto, A, B, C, D + + +[INPUT] +; default/bk08/quorum +ZXKeyMap=default +; you can define own layout, naming section in this INI file [ZX.KEYS.myname] +; create layouts for xas/storm/zxasm/alasm/zxword/sts/etc yourself, i'm bored +KeybLayout=default +KeybPCMode=0 ; when enabled, using pc defaults, ex: SHIFT+7 => & +Mouse=KEMPSTON ; mouse type: NONE/KEMPSTON/AY +Wheel=KEMPSTON ; mouse wheel: NONE/KEMPSTON/KEYBOARD +JoyMouse=0 ; emulate kempston joystick on mouse +MouseScale=0 ; logarithmic scale: ZX_mouse=PC_mouse*2^(Scale), valid: [-3;3] +SwapMouse=0 ; swap left and right mouse buttons +KJoystick=1 ; emulate kempston joystick on keyboard and/or gameport +Matrix=1 ; emulate keymatrix effect +Fire=KFIRE ; autofire key -> kempston +FireRate=1 ; autofire button up/down delay (INTs) +AltLock=1 ; does not update ZX-SPECTRUM keyboard while ALT pressed +ATMKBD=0 ; ATM PC/XT keyboard controller +Joy=0 ; Joystick id (0, 1, ...) + +; clipboad paste delays +HoldDelay=2 +ReleaseDelay=5 +NewlineDelay=20 + + +[ULA] +Frame=71680 ; t-states in frame +; Frame=250000 ; t-states in frame - 14MHz +Line=224 ; t-states in line +; Line=784 ; t-states in line - 14MHz +int=50 ; int freq +intstart=13 ; t-states before int +intlen=32 ; int length in t-states +EvenM1=0 ; align M1 cycle to even T-state (for scorpion) +4TBorder=0 ; update border every 4T states (for scorpion) +FloatBus=0 ; unstable data bus +FloatDOS=0 ; unstable data bus in TR-DOS mode +PortFF=0 ; enable/disable port FF + +Preset= ; don't use above settings and load preset + +; PRESET.NAME=FRAME,PAPER,LINE,INT,INTLEN,EvenM1,4TBorder,floatBus,floatDOS,PortFF +PRESET.PENTAGON=71680,13,224,50,32,0,0,0,0,0 +;PRESET.PENTAGON=143360,17989,224,50,32,0,0,0,0,0 +PRESET.SCORPION=69888,14344,224,50,32,1,1,0,0,1 +PRESET.ATM1_2_3.5MHz=69888,17989,224,50,32,0,0,0,0,1 +PRESET.ATM1_2_7.0MHz=99880,17989,224,50,32,0,0,0,0,1 +PRESET.PROFI=69888,12580,224,50,28,0,0,0,0,0 ; thanks to DDp + +; ATM 7.10 hi-res video modes swap RAM/CPU address bus A5-A7<=>A8-A10 +AtmMemSwap=0 +; reprogram color DACs with ATM palette. with this option +; noflic filter works only in fullscreen 16/32-bit, +; colors of system leds are also affected +UsePalette=1 +ProfiMonochrome=0 + +[VIDEO] + +VSync=0 ; enable for slower, but less jerky screen repaint. + ; uses backbuffer - requires twice more video memory + ; WARNING: eats a lot of cpu time! + +FullScr=0 ; start at full-screen. windowed mode can be used only for + ; GDI, Blitter or Overlay video filter / driver + +Refresh=0 ; monitor refresh rate in fullscreen mode (0-default). + ; for video=resampler, the more - the better + +Border=3 ; border size - 0: 256x192, 1: 320x200, 2: 320x240, 3: 360x288, 4: 384x304, 5: 448x320 +NoFlic=0 ; apply noflic filter +AltNoFlic=0 ; use interlaced algorithm for video=double +FlashColor=0 ; + +MinRes=480 ; minimal screen y-resolution in fullscreen mode + ; use 480 or higher to avoid switching mode when entering monitor + ; use 1024 to force 1280x1024 on LCD instead of 1280x960 + + +ChunkSize=auto ; 2,4, or auto-detect (only for ch* videofilters) +PixelScroll=0 ; detect per-pixel scrolling for video=text + + +; frame resampler options: +rsm.frames=4 ; frames to mix (2-8) + +; fir interpolation mode: +; 2C - 12hz cut-off (gigascreen), 3C - 8hz cut-off (3-color) +; FULL - full details (scrollers), SIMPLE - average of last 2 frames +rsm.mode=2C + + +; scale factor for 'video=advmame'. accepted values: 2,3,4 +; 4x scale requires 1280x960 pixels. use border=none, if your monitor displays only 1024x768 +scale=2 + +; window scale factor (for hardware stretching) +winscale=1 + +; video filter/renderer + +video=double + +; values for video filter: +; normal - fastest, but supports only standart spectrum screen, noflic, flash-color and HWMC +; double - slower, but offers better quality and works in: pentagon 512x192, profi 512x240, ... +; triple - 3x picture scale +; quad - 4x picture scale, designed to use in LCD with 1280x1024 to avoid hardware stretching +; use with minres=1024 to avoid 1280x960 mode +; text - converts 4x8 fonts to 8x8 or 8x16 (for reading e-zines) +; resampler - converts spectrum 50hz-int into 60/75/80/... hz display refresh +; bilinear - color interpolation (MMX) +; scale - fake 'vector' scaling +; advmame - 2x,3x,4x scaling algorithm from AdvanceMAME project +; tv - color TV emulation, windowed mode +; ch_ov - chunky (fast), windowed mode (overlay, 16bit) +; ch_hw - chunky (fast), windowed mode (hardware accel, 32bit) +; ch_bl - chunky (filtered,320x240x16) +; ch_b - chunky (filtered,640x480x16) +; ch4true - 32bit 4x4 chunky, full color precision (slow, but no special hardware reqd) + +; driver for video=normal/double/triple/quad/text + +driver=gdi + +; video driver: +; ddraw - direct access to video memory, fullscreen only, fastest +; gdi - standart windows driver (slowest, but most compatible) +; blt - hardware blitter. recommended for accelerated cards (geforce4/etc) +; ovr - video overlay. recommended in windowed mode for slow video cards +; ddrawh, ddrawt - fullscreen 16- and 32-bit modes + +fastlines=0 ; for video=double - draw twice faster in expense of visual quality + ; for video=anti64 - 4x8->8x8, else 4x8->8x16 + +; use overlay is faster, but you'll get wrong colors if videocard can't +; use RGB555/RGB565 pixels formats for overlay (such as all nVidia cards) +; some video cards do interpolation in overlay mode, +; even if we don't requested it + +ScanIntens=100;45 ; (%) bright for scan lines when video=double,fastlines=0 + ; only for true-color and high-color modes + ; 8-bit modes use palette values ZN,ZB + +; ignore these filters +Hide= ;ch_bl,ch_ov,ch4true + +; update border for CPU expensive filters +Update=1 +; how much frames to skip before displaying frame (for PCI video set to 2) +SkipFrame=0 +; don't wastetime on drawing when running on max speed +SkipFrameMaxSpeed=64 +; screenshot format: SCR, BMP, PNG +ScrShot=PNG +; screenshot directory. +ScrShotDir=. +; when enabled, displays videocard vendor id, device id, card name +; (warning: sometimes uses driver database at http://crl.microsoft.com !!!) +; when disabled, faster startup but no additional information +DetectModel=0 + +; apply filter for 1x2 Atari chunks. situable for games, converted from XL, +; like SpyVsSpy, Flying Shark. presets for games defined in [COLORS] section +; (for now, filter works in 8-bit and 16-bit-normal /not-double/ modes) +;AtariPreset=fl_shark_red_palette +AtariPreset=none + +; ffmpeg settings +; exec: path and name of ffmpeg executable (without quotes) +; newconsole: 1 - open new console for ffmpeg output, +; 0 - print ffmpeg output into emul's console (useful for debug) +; parm: encoding settings (see ffmpeg doc) +; vout: output video file name (use '#' sign for sequence number substitution) +ffmpeg.exec=ffmpeg.exe +ffmpeg.newconsole=1 + +; ffmpeg encoding options +; -ss 00:00:00.500 - skip first 500 ms (skip 25 frames with status line) +; -af volume=3.0 - gain sound volume by 3 +; -vf "..." - apply video filter +; -r 25 - set 25 fps +; -c:a ... - set audio codec ("copy" for uncompressed wav) +; -c:v ... - set video codec ("copy" for uncompressed rgb24) +; -b:a 320k - set bitrate for audio +; -b:v 2800k - set bitrate for video + +;# mp3:320kbps, x264:baseline,10, fast +ffmpeg.parm=-c:a libmp3lame -b:a 320k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -ss 00:00:00.500 +ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:baseline,10, fast +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:baseline,10, slow +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt yuvj420p -preset:v veryslow -profile:v baseline -crf 10 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:lossless, fast +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt rgb24 -preset:v ultrafast -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# aac:256kbps, x264:lossless, slow +;ffmpeg.parm=-c:a libvo_aacenc -b:a 256k -af volume=3.000000 -c:v libx264 -pix_fmt rgb24 -preset:v veryslow -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# wav, x264:lossless, fast +;ffmpeg.parm=-c:a copy -c:v libx264 -pix_fmt yuvj420p -preset:v ultrafast -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# wav, x264:lossless, slow +;ffmpeg.parm=-c:a copy -c:v libx264 -pix_fmt yuvj420p -preset:v veryslow -qp 0 -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# uncompressed +;ffmpeg.parm=-c:a copy -c:v copy -ss 00:00:00.500 +;ffmpeg.vout=video#.avi + +;# Image sequence: PNG +;ffmpeg.parm= +;ffmpeg.vout=video#_%06d.png + +;# PAL DVD video +; MUST use picture size greater than 720x576 (for example, DOUBLE SIZE and COMPLETE border)! +;ffmpeg.parm=-af volume=3.000000 -bf 2 -vf "crop=720:576,tinterlace=mode=interlacex2" -aspect 4:3 -target pal-dvd -r 25 -b:v 2800k -ss 00:00:00.500 +;ffmpeg.vout=video#.mpg + +;# PAL DVD video +; MUST use picture size lower than 720x576 (and DOUBLE SIZE for correct interlace)! +;ffmpeg.parm=-af volume=3.000000 -bf 2 -vf "pad=720:576:(ow-iw)/2:(oh-ih)/2,tinterlace=mode=interlacex2" -aspect 4:3 -target pal-dvd -r 25 -b:v 2800k -ss 00:00:00.500 +;ffmpeg.vout=video#.mpg + +;# RTMP streaming: justin.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -f flv +;ffmpeg.vout=rtmp://live.justin.tv/app/live_74829844_mfrdpoeg034tn03gn03ring3f0rngc + +;# RTMP streaming: own3d.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -f flv +;ffmpeg.vout=rtmp://live.eu.own3d.tv/live/b8493921_949585_kjhb5632l3l1 + +;# RTMP streaming: twitch.tv +;ffmpeg.parm=-af volume=3.000000 -r 10 -ss 00:00:00.500 -c:v libx264 -pix_fmt yuvj420p -preset:v veryfast -profile:v baseline -crf 10 -bufsize 1835k -f flv +;ffmpeg.vout=rtmp://live.justin.tv/app/live_sub_5b8ed4fae83fe83e920227337beab7e73b7a3ba3 + +[BETA128] +Beta128=1 +Noise=1 ; seek noise +Traps=1 ; intercept sector save/load routines in TR-DOS ROM for faster loading +Fast=1 ; disable all FDD/FDC delays. some programs will not work +IL=1 ; sector interleave (1=1:1, 2=2:1, 3=3:1) applied when loading TRD/SCL + ; if you prefer fast=0, set to 2 for 3d13 loaders, to 1 for turbo-loaders +BOOT=boot.$b + +[SOUND] +SoundFilter=0 ; lowpass filter (good for beeper) +SoundDrv=ds ; wave, ds or none +RejectDC=1 ; reject DC component of output sound + +; sound buffer size for SoundDrv=wave +; the more buffer, the more delay before sound playing... +; if sound is jerky, try SoundBuffer=16 +; for really fast computers with windows 2000, try SoundBuffer=4 +SoundBuffer=auto;10 ; only for SoundDrv=wave + +DSPrimary=0;1 ; use primary buffer for DSound. no sound in background. + ; useful only for troubleshooting + + +; when [SOUND] Enabled=0, emulator runs on maximum speed +Enabled=1 + +Fq=44100 ; check maximum sampling rate in your soundcard manual + ; setting freq not supported by hardware + ; will cause resampling and degrade quality and performance + +GSType=BASS ; BASS, Z80 or NONE +GSReset=1 ; reinit GS on reset + +SD=1 ; enable/disable soundrive +CovoxFB=1 ; enable/disable pentagon covox +CovoxDD=1 ; enable/disable scorpion covox + +Saa1099=0 ; enable/disable saa1099 +MoonSound=1 ; enable/disable moonsound + +; max sound volume is 8192. set to 0 to completely disable sound device +BeeperVol=8192 ; most popular sound device +MicOutVol=1000 ; tape saving +MicInVol=1000 ; tape loading +AYVol=8192 ; volume of each channel +CovoxFBVol=8192 ; pentagon covox +CovoxDDVol=6000 ; scorpion covox +CovoxProfiVol=6000 ; profi covox +SDVol=4000 ; soundrive +GSVol=8000 ; general sound (for both high- and low- level emulation modes) +BASSVol=8000 ; MOD-player of BASS.DLL +MoonSoundVol=8000 ; ZXM-MoonSound + +[NGS] ; neo gs settings +RamSize=2048 ; ngs ram size 2048, 4096 + +[ZC] ; Z-Controller settings +; sdcard image +SDCARD=wc.img +SDDelay=1500 ; delay before data token, T-states 3.5MHz + +[SAA1099] +FQ=8000000 + +[AY] +Chip=YM2203 ; bus reaction (none/AY/YM/YM2203) +FQ=1774400 ; chip clock fq +Stereo=ABC ; AY stereo mode - any of STEREO.* +VolTab=default.YM ; volume table - any of VOLTAB.* +UseSamples=0 ; 0 - square tones, 1 - digital samples (low quality) +; double-AY scheme: +; none - no soundchip +; default - single AY/YM +; PSEUDO - pseudo-turbo (one port for two devices + some phase shift) +; QUADRO - pentagon 2nd AY on #AFFD,#EFFD +; POS - power of sound turbo-AY (bit 0 of port #1F) +; CHRV - NedoPC turbo-sound (switch chip on selection reg #FE/FF) +Scheme=CHRV + + +; STEREO.PRESET_NAME=A_left,A_right,B_left,B_right,C_left,C_right +; (you can define your custom presets, all numbers are from [0; 100]) +STEREO.ABC=100,10,66,66,10,100 +STEREO.ACB=100,10,10,100,66,66 +STEREO.BAC=66,66,100,10,10,100 +STEREO.mono=66,66,66,66,66,66 +STEREO.unreal=90,20,66,66,20,90 + +; volume tables +VOLTAB.default.AY=0000,0340,04C0,06F2,0A44,0F13,1510,227E,289F,414E,5B21,7258,905E,B550,D7A0,FFFF +VOLTAB.default.YM=0000,0000,00EF,01D0,0290,032A,03EE,04D2,0611,0782,0912,0A36,0C31,0EB6,1130,13A0,1751,1BF5,20E2,2594,2CA1,357F,3E45,475E,5502,6620,7730,8844,A1D2,C102,E0A2,FFFF +VOLTAB.BULBA_OPEN.AY=0000,1111,2222,3333,4444,5555,6666,7777,8888,9999,AAAA,BBBB,CCCC,DDDD,EEEE,FFFF +VOLTAB.BULBA_OPEN.YM=0000,0000,041A,08D4,11A8,1A7B,234F,2C23,34F7,3DCB,469F,4F72,5846,611A,69EE,72C2,7B96,8469,8D3D,9611,9EE5,A7B9,B08D,B960,C234,CB08,D3DB,DCB0,E584,EE57,F72B,FFFF +VOLTAB.DELPHISPEC=0136,0170,01B5,0208,026A,02DF,0369,040E,04D2,05BB,06CF,0818,099F,0B6F,0D97,1026,1332,16D0,1B1D,203A,264D,2D85,361A,404D,4C6C,5AD4,6BF3,804D,987C,B53B,D764,FFFF +VOLTAB.X128=0000,0200,0500,0700,0A00,0C00,1200,1600,1D00,2200,2600,2C00,3F00,3F00,3F00,FF00 +VOLTAB.YASE=0000,0200,0500,0700,0A00,0C00,1200,1600,1D00,2200,2600,2C00,3F00,3F00,3F00,FF00 +VOLTAB.ZXMAK=0000,0000,00F8,01C2,029E,033A,03F2,04D7,0610,077F,090A,0A42,0C3B,0EC2,1137,13A7,1750,1BF9,20DF,2596,2C9D,3579,3E55,4768,54FF,6624,773B,883F,A1DA,C0FC,E094,FFFF +;original Lion17.YM=0000,0156,0228,033A,0502,086F,0CD4,17B9,1AF0,2E8D,4047,4F47,6528,7B19,92E1,AAAA +;original Lion17.AY=0000,0014,007F,00BF,00FA,0139,0175,01BB,0241,02F1,03F2,04B2,05DE,076B,08BA,0A0F +VOLTAB.Lion17.YM=0000,0201,033C,04D7,0783,0CA6,133E,2395,2868,45D3,606A,76EA,97BC,B8A5,DC51,FFFF +VOLTAB.Lion17.AY=0000,01FD,0CA0,12FD,18DA,1F1E,2515,2C0A,395C,4ADC,6468,777F,9552,BCCA,DE18,FFFF +;original Vaggelis Kapartzianis=00,03,04,05,06,07,08,0A,0C,0E,11,15,19,1D,23,2A +VOLTAB.Vaggelis Kapartzianis=0000,1249,1861,1E79,2492,2AAA,30C2,3CF3,4924,5555,679E,7FFF,9860,B0C2,D554,FFFF +VOLTAB.RAMSOFT.AY=0000,0364,0500,0700,0A80,1000,1600,2300,2A00,4300,5C00,7300,9180,B400,D800,FFFF +VOLTAB.RAMSOFT.YM=0000,0000,00F8,01C2,029E,033A,03F2,04D7,0610,077F,090A,0A42,0C3B,0EC2,1137,13A7,1750,1BF9,20DF,2596,2C9D,3579,3E55,4768,54FF,6624,773B,883F,A1DA,C0FC,E094,FFFF +VOLTAB.R80=0000,0201,033C,04D7,0783,0CA6,133E,2396,2868,45D4,606A,76EA,97BC,B8A6,DC52,FFFF + +[COLORS] +color=default + +; palette format: +; name=ZZ,ZN,NN,NB,BB,ZB:R11,R12,R13;R21;R22;R23;R31;R32;R33 +; where ZZ,NN,BB - bright levels for black,normal,and bright colors +; ZN,NB,ZB - bright levels for zero+normal, normal+bright, zero+bright +; for GIGASCREEN and FLASH-COLORS +; Rnn - matrix for post-processing: +; real_Red = (Red*R11 + Green*R12 + Blue*R13) / 0x100 +; real_Green = (Red*R21 + Green*R22 + Blue*R23) / 0x100 +; real_Blue = (Red*R31 + Green*R32 + Blue*R33) / 0x100 +; +; note: emulator uses 8-bit precision for color components, +; 8-bit filters: use 6 bit precision (VGA palette limitation) +; overlay & hi-color: truncates results to 5 bit +; true color: no quality loss +; +; R, G, B - 0..0xFF +; R11..R33 - 0..0x100 +; palette settings does not affect chunky modes +; +; default=00,80,C0,E0,FF,C8:100,00,00;00,100,00;00,00,100 + +Mars=00,80,C0,E0,FF,C8:100,00,00;40,C0,00;00,40,C0 +Ocean=20,80,A0,C0,E0,A8:D0,00,30;00,D0,30;00,00,100 +Grey=00,80,C0,E0,FF,C8:49,92,24;49,92,24;49,92,24 +alone=00,60,A0,E0,FF,A0:100,00,00;00,100,00;00,00,100 +pulsar=00,76,CD,E9,FF,9F:100,00,00;00,100,00;00,00,100 +ATM=00,55,AA,E0,FF,80:100,00,00;00,100,00;00,00,100 + +; presets for atari-like mode +; format: : [ , : ]* +; color is a mix of 2 pure spectrum colors, e.g. 11=red+red=red, 47=green+white=light-green, etc... +atari.fl_shark_red_palette=06:EE666600 +atari.test=70:00132177,0F:001199FF,34:33119944 + + +[HDD] +Scheme=NEMO-DIVIDE ; interface type: NONE/ATM/NEMO/NEMO-A8/NEMO-DIVIDE/SMUC/PROFI/DIVIDE +SkipReal=1 ; disable work with physical drives. faster startup when + ; you have no connected spectrum drive(s) + +CDROM=;ASPI;SPTI ; SPTI (native WinNT) or ASPI (use 3rd-party library wnaspi32.dll) + +; for image file, specify filename with full path, else it'll not work + +; master device. specify image filename or to use real drive +Image0=wc.img +CHS0=1572/16/63 ; max size, accessible through CHS. not used for real drive +LBA0=0 ; max size, accessible through LBA. not used for real drive +HD0RO=0 ; read only flag +CD0=0 ; 1 if image is cdrom + +; slave device. empty filename used for disconnected device +Image1= +;<_NEC CD-RW NR-7800B> +; +CHS1=1937/16/63 +LBA1=1950720 +HD1RO=0 +CD1=1 ; 1 if image is cdrom + +[ROM] +; general sound firmware +GS=rom\bootgs.rom +; moonsound wavetable +MOONSOUND=rom\YRW801-M - Yamaha - 1993.rom + + +; 64/128/512/1024K ROM images (single file) + +PENTAGON=rom\pentagon.rom + +ATM1=rom\atm1.rom + +;ATM2=Xbios103.rom +ATM2=rom\atm2.rom + +ATM3=rom\zxevo.rom + +; standard PROFI 64K rom +PROFI=rom\profi.rom + +; standard scorpion 64K rom +SCORP=rom\scorpion.rom + +; for SMUC 512k ROM, use file.rom:0 and file.rom:1 to select active bank +PROFROM=rom\scorp_prof401.ROM:0 + +; standard GMX 512K rom +GMX=rom\gmx.rom + +; standard KAY 64K rom +KAY=rom\kay1024.rom + +; TS-config +TSL=rom\zxevo.rom + +; LSY256 +LSY=rom\lsy256.rom + +; ZXM-Phoenix +PHOENIX=rom\ZXM-Phoenix_bios.bin + +; you can create own 64K-ROMSET, naming ini section [ROM.my_own_set] +; for empty ROMSET, single-file large ROM used (accordingly to memory model) +ROMSET= + +[ROM.default] +title=Separate ROMs set +; service rom [optional] +sys=rom\glukpen.rom +; basic48 - high 16K of sinclair rom [required!] +sos=rom\2006.rom +; tr-dos [optional] +dos=rom\dos6_10e.rom +; basic128 - low 16K of sinclair rom [optional] +128=rom\qc_3_05.rom + +[ROM.pentagon] +title=Pentagon-128 + TR-DOS +128=rom\128_low.rom +sos=rom\48for128.rom +dos=rom\trdos504t.ROM +sys=rom\service.rom + +[ROM.GLUK] +title=Mr Gluk Reset Service +128=rom\128.rom +sos=rom\48.rom +dos=rom\dos6_10e.rom +sys=rom\glukpen.rom + +[ROM.scorpion] +title=Scorpion (64K,v2.92) +128=rom\scorpion.rom:0 +sos=rom\scorpion.rom:1 +sys=rom\scorpion.rom:2 +dos=rom\scorpion.rom:3 + +[ROM.profi] +title=PROFI (64k) +sys=rom\profi.rom:0 +dos=rom\profi.rom:1 +128=rom\profi.rom:2 +sos=rom\profi.rom:3 + +[ROM.KAY] +title=KAY (64k) +128=rom\kay1024s.rom:0 +sos=rom\kay1024s.rom:1 +sys=rom\kay1024s.rom:2 +dos=rom\kay1024s.rom:3 + +[ROM.48K] +title=ZX-Spectrum 48K +sos=rom\48.rom + +[ROM.128K] +title=ZX-Spectrum 128K +128=rom\128.rom:0 +sos=rom\128.rom:1 + +[ROM.ATM1] +title=ATM1 +sos=rom\atm1.rom:0 +dos=rom\atm1.rom:1 +128=rom\atm1.rom:2 +sys=rom\atm1.rom:3 + +[ROM.ATM2] +title=ATM2 +sos=rom\atm2.rom:0 +dos=rom\atm2.rom:1 +128=rom\atm2.rom:2 +sys=rom\atm2.rom:3 + +[ROM.ATM3] +title=ATM3 +sos=rom\zxevo.rom:0 +dos=rom\zxevo.rom:13 +128=rom\zxevo.rom:2 +sys=rom\zxevo.rom:3 + +[LEDS] +; enable leds +leds=1 +; ay amplitude peaks on keyboard leds +KBD_AY=0 + +; led coordinates in pixels. comment out, if you don't want some led +; negative coordinates are offset from bottom and right +; WARNING! if you choose coordinates outside visible screen area +; emulator will crash + +; AY volumes. color indicates noise, envelope or digital sound use +AY=1:1,1 +; show Z80 t-states between HALTs and PC framerate +Perf=1:1,-11 +PerfShowT=0 ; display used CPU t-states + +; GS/TRDOS/TAPE read/write +LOAD=1:-24,1 +; active input devices: keyboard, mouse, kempston +Input=1:20,1 +; local time +Time=1:-32,-10 +; on-screen watches (debugger) +OSW=0:-50,26 +; zx-spectrum memory in dynamic: read/write/execute +MemBand=0:60,3 +; bytes per pixel in memory band (allowed 64,128,256,512) +BandBpp=256 + +[ARC] +; these files are ignored +SkipFiles=*.nfo;*.txt;*.diz;*.inf;files.bbs;descript.ion + +; you may add your own archivers! + +; command line to extract all files without pathnames and without +; queries on overwrite, use %s to indicate archive filename; +; use archivers, that understand long filenames! +CAB=extrac32 /E /Y "%s" +ZIP=pkzip25 -extract=all -overwrite=all "%s" +ZIP=pkunzip -o -Jahrs %s +ZIP=pkunzip -o %s +ZIP=pkunzip %s +RAR=rar32 e -y "%s" +RAR=rar e -y "%s" + +[SYSTEM.KEYS] + +; pc keyboard: +; +; ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 PRSCR SCLOCK PAUSE +; TIL 1 2 3 4 5 6 7 8 9 0 MINUS PLUS BACK INS HOME PGUP NUMLOCK GRDIV GRMUL GRSUB +; TAB Q W E R T Y U I O P LB RB DEL END PGDN N7 N8 N9 GRADD +; CAPS A S D F G H J K L COL QUOTE ENTER N4 N5 N6 +; LSHIFT Z X C V B N M COMMA POINT SLASH RSHIFT BACKSL UP N1 N2 N3 GRENTER +; LCONTROL LALT SPACE RALT MENU RCONTROL LEFT DOWN RIGHT N0 NP + +; LMB,RMB,MMB - mouse buttons +; MWU,MWD - mouse wheel up/down +; JLEFT,JRIGHT,JUP,JDOWN,JFIRE - joystick/gamepad +; JB0..JB31 - joystick/gamepad buttons + +; mouse & joystick "keys" can't be bound to commands, only to spectrum keys + +; p.s. +; CONTROL = LCONTROL or RCONTROL +; ALT = LALT or RALT +; SHIFT = LSHIFT or RSHIFT +; numlock must be on for N0-N9 and NP + +; system commands: +; command=key1 [key2 [key3 [key4]]] + +; keys active in emulation mode + +main.exit=ALT F4 ; why do this? +main.lockmouse=SHIFT ESC ; read kempston mouse in windowed mode +main.monitor=TIL ; for hackers only +main.selectfilter=F4 ; select video filter +main.selectdriver=SHIFT F4 ; select video driver for some filters +main.fullscreen=ALT ENTER ; toggle full-screen on/off +main.pause=PAUSE ; pause +main.selectfix=GRMUL ; select video parameter +main.selectsnd=ALT GRMUL ; select soundchip parameter or palette +main.incfix=SHIFT GRADD ; fine tuneup +main.decfix=SHIFT GRSUB ; fine tuneup +main.incfix10=GRADD ; tuneup +main.decfix10=GRSUB ; tuneup +main.leds=GRDIV ; leds on/off +main.maxspeed=NUMLOCK ; max speed on/off +main.pokedialog=F6 ; enter poke(s) +main.starttape=F7 ; start/stop tape +main.tapebrowser=SHIFT F7 ; tape browser +main.screenshot=ALT F8 ; screenshot +main.savevideo=CONTROL F8 ; save video +main.reset=F12 ; reset to [MISC]Reset=DOS/BASIC/MENU/SYS +main.reset128=CONTROL SHIFT F12 ; reset to basic 128 +main.resetsys=SHIFT F12 ; reset to service ROM +main.reset48=ALT SHIFT F12 ; reset to basic 48 with locked 128k memory +main.resetbasic=ALT F12 ; reset to basic 48 with unlocked 128k memory +main.resetdos=CONTROL F12 ; reset to TR-DOS +main.resetcache=ALT CONTROL F12 ; reset to cache +main.nmi=F11 ;ALT SHIFT F11 ; NMI without ROM switching +main.nmidos=CONTROL F11 ; TR-DOS magic +main.nmicache=ALT F11 ; NMI in cache +main.help=F1 ; show keys +main.settings=ALT F1 ; emulation settings (GUI) +main.save=F2 ; save disk/snapshot +main.load=F3 ; load disk/tape/snapshot +main.savesound=F5 ; save WAV/VTX +main.qsave1=ALT F2 ; quick save to qsave1.sna +main.qsave2=CONTROL F2 ; quick save to qsave2.sna +main.qsave3=SHIFT F2 ; quick save to qsave3.sna +main.qload1=ALT F3 ; quick load from qsave1.sna +main.qload2=CONTROL F3 ; quick load from qsave2.sna +main.qload3=SHIFT F3 ; quick load from qsave3.sna +main.keystick=SCLOCK ; toggle keystick mode +main.autofire=ALT NUMLOCK ; toggle autofire mode +main.saveall=F9 ; quick save cmos and disks +main.xtkbd=ALT CONTROL Z ; enable/disable ATM XT keyboard (emulation controls blocked!) +main.pastetext=ALT SHIFT INS ; copy text from clipboard to keyboard buffer +main.size1=ALT 1 ; set normal window size (in windowed mode) +main.size2=ALT 2 ; set double window size (in windowed mode) +main.sizem=ALT 3 ; maximize window (in windowed mode) +main.memsearch=ALT F6 ; search in memory for changed values (cheats, etc) +main.savevideo=CONTROL F8 ; save video + +; keys in all monitor windows + +mon.cpu=CONTROL TIL ; switch to next cpu +mon.exit=ALT F4 ; +mon.emul=TIL ; back to emulation +mon.bpdialog=ALT C ; conditional breakpoints dialog +mon.gs=ALT G ; gs status dialog +mon.pokedialog=ALT P ; enter poke(s) F6 is already used +mon.tapebrowser=SHIFT F7 ; tape browser +mon.reset=F12 ; reset to [MISC]Reset=DOS/BASIC/MENU/SYS +mon.reset128=CONTROL SHIFT F12 ; reset to basic 128 +mon.resetsys=ALT F12 ; reset to service ROM +mon.reset48=ALT SHIFT F12 ; reset to basic 48 with locked 128k memory +mon.resetbasic=SHIFT F12 ; reset to basic 48 with unlocked 128k memory +mon.resetdos=CONTROL F12 ; reset to TR-DOS +mon.resetcache=ALT CONTROL F12 ; reset to cache +mon.nmi=ALT SHIFT F11 ; NMI without ROM switching +mon.nmidos=CONTROL F11 ; TR-DOS magic +mon.nmicache=ALT F11 ; NMI in cache +mon.help=F1 ; show keys +mon.settings=ALT F1 ; emulation settings (GUI) +mon.save=F2 ; save disk/snapshot +mon.load=F3 ; load disk/tape/snapshot +mon.savesound=F5 ; save WAV/VTX +mon.qsave1=ALT F2 ; quick save to qsave1.sna +mon.qsave2=CONTROL F2 ; quick save to qsave2.sna +mon.qsave3=SHIFT F2 ; quick save to qsave3.sna +mon.qload1=ALT F3 ; quick load from qsave1.sna +mon.qload2=CONTROL F3 ; quick load from qsave2.sna +mon.qload3=SHIFT F3 ; quick load from qsave3.sna +mon.setrange=F6 ; set range of breakpoints +mon.resetrange=SHIFT F6 ; reset range of breakpoints +mon.screen=F9 ; show screen, as it present in video memory +mon.altscreen=SHIFT F9 ; show inactive screen +mon.rayscreen=ALT F9 ; show painted screen area until crt-ray (with MC, border & 2-scr effects) +mon.step=F7 ; single step +mon.stepover=F8 ; step over loops and calls +mon.exitsub=F11 ; trace until (sp) +mon.loadblock=ALT R ; load memory block +mon.saveblock=ALT W ; save memory block +mon.fillblock=ALT F ; fill memory block with pattern +mon.setbank=ALT B ; write to #7FFD +mon.sethimem=ALT M ; write to model-specific extended memory port +mon.next=TAB ; next window +mon.prev=SHIFT TAB ; prev window +mon.dump=ALT D ; toggle dump +mon.rip=ALT T ; ripper's tool +mon.osw=ALT O ; setup on-screen watches +mon.scrshot=ALT S ; toggle screenshot/scrdump/watches +mon.setwatch=CONTROL U ; set user-defined watch address +mon.switchay=ALT Y ; switch active AY (turbo-sound) +mon.labels=CONTROL J ; goto label +mon.memsearch=ALT F6 ; search in memory for changed values (cheats, etc) +mon.switchdump=CONTROL D ; CMOS/NVRAM editor + +; keys in registers window + +reg.left=LEFT ; select register +reg.right=RIGHT ; select register +reg.up=UP ; select register +reg.down=DOWN ; select register +reg.edit=ENTER ; edit current register +reg.a=CONTROL A ; edit A +reg.f=CONTROL F ; edit flags +reg.bc=CONTROL B ; edit BC +reg.de=CONTROL D ; edit DE +reg.hl=H ; edit HL +reg.pc=P ; edit PC +reg.sp=S ; edit SP +reg.ix=X ; edit IX +reg.iy=Y ; edit IY +reg.i=I ; edit i +reg.r=R ; edit R +reg.im=M ; edit im +reg.iff1=CONTROL 1 ; edit iff1 +reg.iff2=CONTROL 2 ; edit iff2 +reg.SF=ALT S ; toggle SF +reg.ZF=ALT Z ; toggle ZF +reg.F5=ALT 5 ; toggle F5 +reg.HF=ALT H ; toggle HF +reg.F3=ALT 3 ; toggle F3 +reg.PF=ALT P ; toggle PF/PV +reg.NF=ALT N ; toggle NF +reg.CF=ALT C ; toggle CF +reg.codejump=QUOTE ; goto address in code window under cursor +reg.datajump=COL ; goto address in data window under cursor + +; keys in cpu window + +cpu.findpc=HOME ; set cursor at PC +cpu.here=F4 ; trace to cursor +cpu.findtext=ALT F7 ; find string +cpu.findcode=CONTROL F7 ; find code with mask +cpu.goto=G ; goto address +cpu.bpx=SPACE ; breakpoint under cursor +cpu.asm=ENTER ; edit instruction +cpu.setpc=Z ; set PC to cursor +cpu.up=UP ; move cursor up +;cpu.up=MWU ; move cursor up +cpu.down=DOWN ; move cursor down +;cpu.down=MWD ; move cursor down +cpu.left=LEFT ; move cursor left +cpu.right=RIGHT ; move cursor right +cpu.pgdn=PGDN ; next page +cpu.pgup=PGUP ; prev page +cpu.save1=CONTROL 1 ; save cursor position to slot 1 +cpu.save2=CONTROL 2 +cpu.save3=CONTROL 3 +cpu.save4=CONTROL 4 +cpu.save5=CONTROL 5 +cpu.save6=CONTROL 6 +cpu.save7=CONTROL 7 +cpu.save8=CONTROL 8 +cpu.rest1=1 ; save cursor position to jumpstack, load from slot 1 +cpu.rest2=2 +cpu.rest3=3 +cpu.rest4=4 +cpu.rest5=5 +cpu.rest6=6 +cpu.rest7=7 +cpu.rest8=8 +cpu.back=BACK ; pop cursor position from jumpstack +cpu.context=QUOTE ; push cursor position and goto instruction operand +cpu.datajump=COL ; jump to instruction operand in data window +cpu.labels=CONTROL L ; show labels on/off +cpu.importl=CONTROL A ; menu for importing labels from XAS/ALASM + +; keys in memory dump window + +mem.left=LEFT ; cursor left +mem.right=RIGHT ; cursor right +mem.up=UP ; cursor up +mem.down=DOWN ; cursor down +mem.pgup=PGUP ; page up +mem.pgdn=PGDN ; page down +mem.switch=CONTROL TAB ; move to hex/ascii +mem.stline=HOME ; start of line +mem.endline=END ; end of line +mem.findtext=ALT F7 ; find text in memory / disk track +mem.findcode=CONTROL F7 ; find code with mask in memory / disk track +mem.goto=CONTROL G ; goto address +mem.mem=CONTROL M ; select memory editor +mem.diskphys=CONTROL V ; select disk editor (physical track) +mem.disklog=CONTROL O ; select disk editor (logical sectors) +mem.diskgo=CONTROL T ; select drive/track/sector in diskeditor +mem.pc=CONTROL P ; goto PC +mem.sp=CONTROL S ; goto SP +mem.bc=CONTROL B ; goto BC +mem.de=CONTROL D ; goto DE +mem.hl=CONTROL H ; goto HL +mem.ix=CONTROL X ; goto IX +mem.iy=CONTROL Y ; goto IY + + + +[ZX.KEYS.default] + +Name=unreal default + +; ZX keyboard layout: +; +; 1 2 3 4 5 6 7 8 9 0 +; Q W E R T Y U I O P +; A S D F G H J K L ENT +; CAP Z X C V B N M SYM SPC + +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick + +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM K +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM Z +TAB=CAP SPC ; break +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM CAP + +LSHIFT=CAP +RSHIFT=SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT + +MWU=CAP 7 +MWD=CAP 6 + +JLEFT=KLEFT +JRIGHT=KRIGHT +JUP=KUP +JDOWN=KDOWN +JFIRE=KFIRE + +[ZX.KEYS.XAS] + +Name=XAS 7.xx (incomplete) + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +SHIFT=CAP +CONTROL=SYM + +[ZX.KEYS.ACEDIT] + +; layout created by Alone Coder + +Name=ACEdit + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM L +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM O +TAB=SYM CAP +ESC=CAP SPC +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM Z + +SHIFT=CAP +CONTROL=SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT +GRSUB=SYM J +GRADD=SYM K +GRMUL=SYM B +GRDIV=SYM V + +[ZX.KEYS.Z80Stealth] + +Name=Z80Stealth default + +; ZX keyboard layout: +; +; 1 2 3 4 5 6 7 8 9 0 +; Q W E R T Y U I O P +; A S D F G H J K L ENT +; CAP Z X C V B N M SYM SPC + +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick + +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY + +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +TIL=CAP 1 +CAPS=CAP 2 +PGUP=CAP 3 +PGDN=CAP 4 +LEFT=CAP 5 +DOWN=CAP 6 +UP=CAP 7 +RIGHT=CAP 8 +DEL=CAP 9 +BACK=CAP 0 +MINUS=SYM J +PLUS=SYM K +COMMA=SYM N +POINT=SYM M +ENTER=ENT +SPACE=SPC +LB=SYM 8 +RB=SYM 9 +COL=SYM Z +TAB=CAP SPC ; break +INS=SYM W +HOME=SYM Q +END=SYM E +QUOTE=SYM P +SLASH=SYM C +BACKSL=SYM CAP + +RALT=SYM +LSHIFT=CAP +RSHIFT=CAP +RCONTROL=CAP SYM + +N4=KLEFT +N6=KRIGHT +N8=KUP +N2=KDOWN +N5=KFIRE +N1=KLEFT KDOWN +N3=KRIGHT KDOWN +N7=KUP KLEFT +N9=KUP KRIGHT + +MWU=CAP 7 +MWD=CAP 6 + +JLEFT=KLEFT +JRIGHT=KRIGHT +JUP=KUP +JDOWN=KDOWN +JFIRE=KFIRE + +[ZX.KEYS.quorum] +Name=Quorum + +; Quorum keyboard layout: +; +; F1 F2 F3 F4 F5 [G] NMI INV [< RES +; [E] 1 2 3 4 5 6 7 8 9 0 - + BS DEL NSLASH NSTAR NMINUS +; TAB Q W E R T Y U I O P [ ] \ N7 N8 N9 +; CAPS A S D F G H J K L ; ' ~ ENT N4 N5 N6 +; RUS LAT Z X C V B N M , . / UP N1 N2 N3 +; CAP FIRE SPC SYM LT DN RT N0 NPOINT NPLUS +; +; FIRE,LT,DN,RT,UP=0,5,6,8,7 +; NMI,RES=F11,F12(see main.*) +; INV,[< - NOT emulated +; KLEFT,KRIGHT,KUP,KDOWN,KFIRE - kempston joystick +; (JLEFT,JRIGHT,JUP,JDOWN,JFIRE reserved for joystick) +; format: +; PC_KEY=[ZX_KEY_SHIFT] ZX_KEY +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 +8=8 +9=9 +0=0 +Q=Q +W=W +E=E +R=R +T=T +Y=Y +U=U +I=I +O=O +P=P +A=A +S=S +D=D +F=F +G=G +H=H +J=J +K=K +L=L +Z=Z +X=X +C=C +V=V +B=B +N=N +M=M +ESC=EBOX +DEL=BS +TIL=TILDA +CAPS=CAPS +LEFT=5 +DOWN=6 +UP=7 +RIGHT=8 +BACK=DEL +MINUS=- +PLUS=+ +COMMA=, +POINT=. +ENTER=ENT +SPACE=SPC +LB=[ +RB=] +COL=COLON +TAB=TAB +;HOME=N7 +;END=N1 +;PGUP=N8 +;PGDN=N2 +N1=N1 +N2=N2 +N3=N3 +N4=N4 +N5=N5 +N6=N6 +N7=N7 +N8=N8 +N9=N9 +N0=N0 +NP=NPOINT +QUOTE=QUOTE +SLASH=/ +BACKSL=\ +F1=F1 +F2=F2 +F3=F3 +F4=F4 +F5=F5 +F6=GBOX +GRDIV=NSLASH +GRMUL=NSTAR +GRSUB=NMINUS +GRADD=NPLUS +PGUP=RUS +PGDN=LAT + +LSHIFT=CAP +RSHIFT=SYM + +;N4=KLEFT +;N6=KRIGHT +;N8=KUP +;N2=KDOWN +;N5=KFIRE +;N1=KLEFT KDOWN +;N3=KRIGHT KDOWN +;N7=KUP KLEFT +;N9=KUP KRIGHT diff --git a/_esp/esp_init.txt b/_esp/esp_init.txt new file mode 100644 index 0000000..c6a6929 --- /dev/null +++ b/_esp/esp_init.txt @@ -0,0 +1,79 @@ +AT +OK +AT+CWJAP_CUR="YV","1234123412" WIFI CONNECTED +WIFI GOT IP + +OK +AT+CIPSTART="TCP","zxart.ee",80 busy p... +CONNECT + +OK +AT+CIPSEND=104 +OK +> +Recv 104 bytes + +SEND OK + ++IPD,504:HTTP/1.1 301 Moved Permanently +Date: Sun, 27 Mar 2016 08:29:50 GMT +Server: Apache / DataZone +Location: http://zxart.ee/ +Content-Length: 293 +Connection: close +Content-Type: text/html; charset=iso-8859-1 + + + +301 Moved Permanently + +

Moved Permanently

+

The document has moved here.

+
+
Apache / DataZone Server at zxart.ee Port 80
+ +CLOSED + + + + +AT +OK +AT+GMR +AT version:0.60.0.0(Jan 29 2016 15:10:17) +SDK version:1.5.2(80914727) +compile time:Jan 29 2016 19:06:50 +OK +AT+CWMODE_DEF? busy p... ++CWMODE_DEF:1 + +OK +AT+CWLAP busy p... ++CWLAP:(3,"win",-77,"08:60:6e:24:89:70",13,85,0) ++CWLAP:(4,"YV",-38,"08:60:6e:d2:f7:58",13,86,0) + +OK +AT+CWJAP_CUR="YV","1234123412" WIFI CONNECTED +WIFI GOT IP + +OK +AT+CIPSTA? +CIPSTA:ip:"192.168.1.248" ++CIPSTA:gateway:"192.168.1.1" ++CIPSTA:netmask:"255.255.255.0" + +OK +AT+PING="google.com" +24 + +OK +AT+CIPSTART="TCP","zxart.ee",80 +busy p... +CONNECT + +AT+CIPSEND=104 +GET /index.php HTTP/1.0 +Host: zxart.ee +User-Agent: ZiFi (ZX Evo) +Accept: */* +Connection: close + + diff --git a/_esp/espprob2.a80 b/_esp/espprob2.a80 new file mode 100644 index 0000000..e620d87 --- /dev/null +++ b/_esp/espprob2.a80 @@ -0,0 +1,742 @@ + relaxed on + cpu z80undoc +HIGH: FUNCTION X,((X>>8)&0xff) + +B_BLACK:macro + ex af,af' + out (0xfe),a + ex af,af' + endm + +B_BLUE: macro + ld a,1 + out (0xfe),a + endm + +B_RED: macro + ld a,2 + out (0xfe),a + endm + +B_GREEN:macro + ld a,4 + out (0xfe),a + endm + +B_CYAN: macro + ld a,5 + out (0xfe),a + endm + +B_YELL: macro + ld a,6 + out (0xfe),a + endm + +bigbuff:equ 0x8000 + + org 0x6000 +;--------------------------------------- + res 4,(iy+1) + ld bc,0x7ffd + ld a,0x17 + out (c),a + ld a,0x07 + ld (0x5c48),a + ld (0x5c8d),a + xor a + out (0xfe),a + call zx_cls + +;read SSID and Password from file + ld hl,bigbuff + push hl + ld de,0 + ld bc,0x0805 + call 0x3d13 + pop hl +p011: ld a,(hl) + jp z,nopass + ld de,str_wifipass + push hl + call ss_cm1 + pop hl + jr z,p020 + ld bc,0x0010 + add hl,bc + ld a,h + cp HIGH(bigbuff+0x0900) + jr nz,p011 + jp nopass +p020: push hl + pop ix + ld l,(ix+0x0b) + ld h,(ix+0x0c) + ld (packsz),hl + ld e,(ix+0x0e) + ld d,(ix+0x0f) + ld hl,ssidbuff + push hl + ld bc,0x0105 + call 0x3d13 + pop hl + ld de,(packsz) +p021: ld a,d + or e + jr z,p029 + ld a,(hl) + or a + jr z,p029 + cp 0x0d + jr z,p022 + cp 0x0a + jr z,p022 + inc hl + dec de + jr p021 +p022: xor a + ld (hl),a + inc hl + dec de + ld a,d + or e + jr z,p029 + ld a,(hl) + or a + jr z,p029 + cp 0x0d + jr z,p022 + cp 0x0a + jr z,p022 + ld (passptr),hl +p023: inc hl + dec de + ld a,d + or e + jr z,p029 + ld a,(hl) + or a + jr z,p029 + cp 0x0d + jr z,p029 + cp 0x0a + jr z,p029 + jr p023 +p029: xor a + ld (hl),a + ex af,af' ;for B_BLACK + +p100: ld hl,p100 + push hl + + ld bc,0xc7ef + ld de,0xfff1 + out (c),e ;Set API mode 1 + out (c),d ;Get Version + in a,(c) + cp 0xff + jp z,nozifi + ld a,0x01 + out (c),a ;Clear RX FIFO + + ld b,3 +p103: push bc + ld de,25 + ld hl,cmd_ate0 + call send_cmd_wait_ok + pop bc + jr z,p104 + djnz p103 + jp x_err +p104: +; + ld hl,msg_req_vers + call zx_puts + ld a,1 + ld (prnansw),a + ld de,25 + ld hl,cmd_gmr + call send_cmd_wait_ok + ld a,0 + ld (prnansw),a + jp nz,x_err +; + ld de,25 + ld hl,cmd_cwmode + call send_cmd_wait_ok + jp nz,x_err + ld de,25 + ld hl,cmd_cwautoconn + call send_cmd_wait_ok + jp nz,x_err + ld de,25 + ld hl,cmd_cwqap + call send_cmd_wait_ok + jp nz,x_err +; +p110: ld hl,msg_press_key + call zx_puts + call zx_getkey +; + ld hl,msg_ap_conn + call zx_puts + ld de,1000 + ld hl,cmd_cwjap1 + call zifi_putstr + ld hl,ssidbuff + call zifi_putstr + ld hl,cmd_cwjap2 + call zifi_putstr + ld hl,(passptr) + call zifi_putstr + ld hl,cmd_cwjap3 + call send_cmd_wait_ok + jp z,p120 + call x_err + jr p110 +; +p120: ld hl,msg_ipcfg + call zx_puts + ld a,1 + ld (prnansw),a + ld de,25 + ld hl,cmd_cipsta + call send_cmd_wait_ok + ld a,0 + ld (prnansw),a + call nz,x_err +; +p199: ld hl,msg_press_key + call zx_puts + call zx_getkey +; +p200: call zx_cls + ld hl,bigbuff + ld (ptr),hl + ld de,bigbuff+1 + ld bc,16384 + ld (hl),0 + ldir + ld hl,msg_menuload + call zx_puts +p201: call zx_getkey + cp 0x30 + jp z,disconn + cp 0x31 + jr c,p201 + cp 0x3a + jr nc,p201 + sub 0x31 + ld (resnum),a + + ld bc,0xc7ef + ld a,0x01 + out (c),a ;Clear RX FIFO + + ld de,250 + ld hl,cmd_conn2site + call send_cmd_wait_ok + jp z,p210 + cp 0xfa + jp z,p210 + call x_err + jr p199 +p210: + ld hl,cmd_cipsend + call zifi_putstr + ld a,(resnum) + ld l,a + ld h,0 + add hl,hl + add hl,hl + ld de,tabl_ptrurl + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call zifi_putstr + ld hl,str_crlf + call zifi_putstr + + ld de,50 + call set_timeout50 + call wait_ok + jp z,p211 + call x_err + jp p199 + +p211: call zifi_getchar + jr z,p211 + cp '>' + jr nz,p211 + + ld hl,str_get1 + call zifi_putstr + ld a,(resnum) + ld l,a + ld h,0 + add hl,hl + inc hl + add hl,hl + ld de,tabl_ptrurl + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call zifi_putstr + ld hl,str_get2 + call zifi_putstr + + ld de,50 + call set_timeout50 + call wait_ok + cp 0xfd + jp z,p220 + call x_err + jp p199 + +p220: ld de,1000 + call set_timeout50 + +p22a: ld hl,strbuff + ld (hl),0 + call rdipd + ld a,(strbuff) + or a + jr nz,p221 + call x_tout + jp p199 +p221: ld de,str_ipd + call ss_cmp + jr z,p222 + call x_err + jp p199 +p222: + ld hl,0 + ld de,strbuff+7 +p223: ld a,(de) + inc de + cp ':' + jr z,p225 + sub 0x30 + ld c,l + ld b,h + add hl,hl + add hl,hl + add hl,bc + add hl,hl + ld c,a + ld b,0 + add hl,bc + jr p223 +p225: ld (packsz),hl + ex de,hl + ld hl,(maxpsz) + xor a + sbc hl,de + jr nc,p226 + ld (maxpsz),de +p226: + ld hl,(ptr) +p231: ld bc,0xc0ef + B_RED + in a,(c) + B_BLACK + jr nz,p232 + call check_timeout + jr c,p231 + call x_tout + jp p199 +p232: cp 0xbf ; + jr c,p233 ; + ld a,0xbf ; ¤ +p233: ld c,a ; ® + ld a,d ; « + or a ; £ + jr nz,p234 ; ® + ld a,e ; + cp c ; § + jr nc,p234 ;   + ld c,e ; ¯ +p234: ex de,hl ; à + xor a ; ï + ld b,a ; £ + sbc hl,bc ;   + ex de,hl ; ¥ + ld b,c ; ¬ + ld c,0xef ; + B_GREEN + inir ; ¨ ¡ëáâà® ¥¤¥¬ + B_BLACK + ld a,d + or e + jr nz,p231 + ld (ptr),hl + + ld hl,(packsz) +maxpsz: equ $+1 + ld de,0 + xor a + sbc hl,de + jp nc,p22a +; + ld hl,bigbuff +p241: ld a,(hl) + inc hl +p242: cp 10 + jr nz,p241 + ld a,(hl) + inc hl + cp 13 + jr nz,p242 + inc hl + + ld a,(resnum) + cp 3 + jp c,pscr0 + cp 6 + jp c,pgiga0 +;pmus0: + push hl + ex de,hl + ld hl,(ptr) + xor a + sbc hl,de + ld c,l + ld b,h + pop hl + ld de,0xc86e + ldir + ld hl,vtpl + ld de,0xc000 + ld bc,sz_vtpl + ldir + ld hl,msg_musply + call zx_puts + call 0xc000 + ei + res 5,(iy+1) +pmus1: halt + call 0xc005 + bit 5,(iy+1) + jr z,pmus1 + call 0xc008 + jp p200 +; +pgiga0: ld de,0x4000 + ld bc,0x1b00 + ldir + ld de,0xc000 + ld bc,0x1b00 + ldir + res 5,(iy+1) + ld bc,0x7ffd +pgiga1: halt + ld a,0x1f + out (c),a + halt + ld a,0x17 + out (c),a + bit 5,(iy+1) + jr z,pgiga1 + jp p200 +; +pscr0: ld de,0x4000 + ld bc,0x1b00 + ldir + call zx_getkey + jp p200 +;------------------------------ +x_err: ld hl,msg_error + cp 1 + jr nz,x_er1 +x_tout: ld hl,msg_timeout +x_er1: call zx_puts + ret +;------------------------------ +nopass: ld hl,msg_nopassfile + jr nhlt +nozifi: ld hl,msg_nozifi +nhlt: call zx_puts + di + jr $-1 +;------------------------------ +disconn:ld hl,cmd_cwqap + call send_cmd_wait_ok + jp 0 +;------------------------------ +send_cmd_wait_ok: + push hl + call set_timeout50 + pop hl + call zifi_putstr +wait_ok:ld hl,strbuff + call rdstr + ld a,(strbuff) + or a + jr nz,_scwo1 + inc a + ret +_scwo1: ld a,(prnansw) + or a + jr z,_scwo2 + ld hl,strbuff + call zx_puts +_scwo2: ld de,str_ok + call ss_cmp + ld a,0x00 + jr z,_scwo9 + ld de,str_fail + call ss_cmp + ld a,0xff + jr z,_scwo9 + ld de,str_error + call ss_cmp + ld a,0xfe + jr z,_scwo9 + ld de,str_send_ok + call ss_cmp + ld a,0xfd + jr z,_scwo9 + ld de,str_already_con + call ss_cmp + ld a,0xfa + jr nz,wait_ok +_scwo9: or a + ret +;------------------------------ +rdstr: call zifi_getchar + jr z,rdst2 + cp 10 ;LF + jr z,rdst3 + ld (hl),a + inc hl + jr rdstr +rdst2: call check_timeout + jr c,rdstr +rdst3: ld (hl),0 + ret +;------------------------------ +rdipd: call zifi_getchar + jr z,ripd2 + ld (hl),a + inc hl + cp ':' + ret z + jr rdipd +ripd2: call check_timeout + jr c,rdipd + ret +;------------------------------ +ss_cmp: ld hl,strbuff +ss_cm1: ld a,(de) + or a + ret z + inc de + cpi + jr z,ss_cm1 + ret +;------------------------------ +zifi_getchar: + ld bc,0xc0ef + B_RED + in a,(c) + B_BLACK + ret z + ld b,0 + B_CYAN + in a,(c) + B_BLACK + dec b + ret +;------------------------------ +zifi_putstr: +; push hl +; call zx_puts +; pop hl + ld bc,0xc1ef +_zfpst0: + B_BLUE + in a,(c) + B_BLACK + jr z,_zfpst0 + cp 0xbf + jr c,_zfpst1 + ld a,0xbf +_zfpst1:ld b,a +_zfpst2:ld a,(hl) + or a + ret z + B_YELL + outi + B_BLACK + jr nz,_zfpst2 + jr zifi_putstr +;------------------------------ +zx_putchar_safe: + cp 10 ;LF + ret z + cp 13 ;CR + jr z,_putc1 + cp 0x20 + jr c,_putc2 + cp 0x80 + jr c,_putc1 +_putc2: ld a,0x7f +_putc1: push hl + rst 0x10 + pop hl + ret +;------------------------------ +zx_puts:ld a,0xff + ld (0x5c8c),a +_puts1: ld a,(hl) + inc hl + or a + ret z + call zx_putchar_safe + jr _puts1 +;------------------------------ +zx_getkey: + res 5,(iy+1) +_getk1: bit 5,(iy+1) + jr z,_getk1 + ld a,(iy-50) + ret +;------------------------------ +zx_cls: ld a,2 + ld (0x5c6b),a + call 0x0d6b + ld a,2 + call 0x1601 + xor a + ld (0x5c6b),a + ret +;------------------------------ +set_timeout50: + ld hl,(0x5c78) + add hl,de + ld (tmout),hl + ret +;------------------------------ +check_timeout: + push hl + push de + ld de,(tmout) + ld hl,(0x5c78) + xor a + sbc hl,de + pop de + pop hl + ret +;------------------------------ +tmout: defw 0 +ptr: defw 0 +packsz: defw 0 +passptr:defw str_empty +resnum: defb 0 +prnansw:defb 0 +;------------------------------ +vtpl: + listing off + include "vtplayer.inc" + listing on +sz_vtpl:equ $-vtpl +;------------------------------ +tabl_ptrurl: + defw str_rqsz1,str_uri1 + defw str_rqsz2,str_uri2 + defw str_rqsz3,str_uri3 + defw str_rqsz4,str_uri4 + defw str_rqsz5,str_uri5 + defw str_rqsz6,str_uri6 + defw str_rqsz7,str_uri7 + defw str_rqsz8,str_uri8 + defw str_rqsz9,str_uri9 +;------------------------------ +msg_nozifi: defb 13,"- No ZiFi-API detect! -",0 +msg_timeout: defb 13,"- Timeout! -",13,0 +msg_error: defb 13,"- Error! -",13,0 + +msg_req_vers: defb "Firmware version:",13,0 +msg_press_key: defb "Press a key",13,0 +msg_ap_conn: defb "Connect to AccessPoint...",13,0 +msg_ipcfg: defb "IP config info...",13,0 +msg_menuload: defb "Now, we can try to load some",13 + defb "pre-defined resources",13 + defb "from the Internet.",13 + defb "1. scr #1",13 + defb "2. scr #2",13 + defb "3. scr #3",13 + defb "4. gigascr #1",13 + defb "5. gigascr #2",13 + defb "6. gigascr #3",13 + defb "7. pt3 #1",13 + defb "8. pt3 #2",13 + defb "9. pt3 #3",13,13 + defb "0. WiFi disconnect",13,0 +msg_musply: defb 13,"PT3-module playing",0 + +cmd_ate0: defb "ATE0" +str_crlf: defb 13,10 +str_empty: defb 0 +cmd_gmr: defb "AT+GMR",13,10,0 +cmd_cwmode: defb "AT+CWMODE_DEF=1",13,10,0 +cmd_cwautoconn: defb "AT+CWAUTOCONN=0",13,10,0 +cmd_cwqap: defb "AT+CWQAP",13,10,0 +cmd_cwjap1: defb "AT+CWJAP_CUR=",0x22,0 +cmd_cwjap2: defb 0x22,0x2c,0x22,0 +cmd_cwjap3: defb 0x22,13,10,0 +cmd_cipsta: defb "AT+CIPSTA?",13,10,0 +cmd_conn2site: defb "AT+CIPSTART=",0x22,"TCP",0x22,",",0x22 + defb "zxart.ee" ; site + defb 0x22,",80",13,10,0 +cmd_cipsend: defb "AT+CIPSEND=",0 + +str_get1: defb "GET ",0 ;size=4 +str_get2: defb " HTTP/1.1",13,10 ;size=125 + defb "Host: zxart.ee",13,10 + defb "User-Agent: ESP8266-probe2 (ZX Evolution; CPU Z80; RAM 4096Kb)",13,10 ; show off ;) + defb "Accept: */*",13,10 + defb "Connection: close",13,10,13,10,0 + +str_uri1: defb "/file/id:84830/filename:Vassa_-_ZX_Moonwalking_%282016%29_%28DiHalt_Lite_2016%2C_2%29.scr",0 ;size=89 +str_rqsz1: defb "218",0 ;218=4+89+125=get1+uri1+get2 + +str_uri2: defb "/file/id:84827/filename:dman_-_Masked_Avenger_%282016%29_%28DiHalt_Lite_2016%2C_3%29.scr",0 ;size=88 +str_rqsz2: defb "217",0 ;217=4+88+125=get1+uri2+get2 + +str_uri3: defb "/file/id:84828/filename:Tzerra_-_Nutcracker_%282016%29_%28DiHalt_Lite_2016%2C_4%29.scr",0 ;size=86 +str_rqsz3: defb "215",0 ;215=4+86+125=get1+uri3+get2 + +str_uri4: defb "/file/id:84829/filename:Lilka_-_Snegovik_%282016%29_%28DiHalt_Lite_2016%2C_6%29.img",0 ;size=83 +str_rqsz4: defb "212",0 ;212=4+83+125=get1+uri4+get2 + +str_uri5: defb "/file/id:83698/filename:Dimidrol_-_Capri_Rendezvous_%282015%29_%28ArtField_2015%2C_1%29.img",0 ;size=91 +str_rqsz5: defb "220",0 ;220=4+91+125=get1+uri5+get2 + +str_uri6: defb "/file/id:61454/filename:Tutty_-_Kpacku_Final_Logo_%282015%29_%28Chaos_Constructions_2015%29.img",0 ;size=95 +str_rqsz6: defb "224",0 ;224=4+95+125=get1+uri6+get2 + +str_uri7: defb "/file/id:84856/filename:MmcM_-_Winter_Frosts_%282016%29_%28DiHalt_Lite_2016%2C_1%29.pt3",0 ;size=87 +str_rqsz7: defb "216",0 ;216=4+87+125=get1+uri7+get2 + +str_uri8: defb "/file/id:84853/filename:Quiet_-_Dream_Catcher_%282016%29_%28DiHalt_Lite_2016%2C_2%29.pt3",0 ;size=88 +str_rqsz8: defb "217",0 ;217=4+88+125=get1+uri8+get2 + +str_uri9: defb "/file/id:84858/filename:Scalesmann_-_losing_the_reason_%282016%29_%28DiHalt_Lite_2016%2C_3%29.pt3",0 ;size=97 +str_rqsz9: defb "226",0 ;226=4+97+125=get1+uri9+get2 + +str_ok: defb "OK",13,0 +str_error: defb "ERROR",13,0 +str_fail: defb "FAIL",13,0 +str_send_ok: defb "SEND OK",13,0 +str_already_con:defb "ALREADY CONNECT",13,0 +str_ipd: defb 13,10,"+IPD,",0 +ssidbuff: +msg_nopassfile: defb 13,"- File 'wifipass' not found! -",0 +str_wifipass: defb "wifipass",0 +strbuff: equ ssidbuff+256 +;------------------------------ diff --git a/_esp/tsconfig.asm b/_esp/tsconfig.asm new file mode 100644 index 0000000..7b83b5a --- /dev/null +++ b/_esp/tsconfig.asm @@ -0,0 +1,180 @@ + +; ------- definitions + +; -- TS-config port regs + +VCONFIG equ $00AF +STATUS equ $00AF +VPAGE equ $01AF +GXOFFSL equ $02AF +GXOFFSH equ $03AF +GYOFFSL equ $04AF +GYOFFSH equ $05AF +TSCONFIG equ $06AF +PALSEL equ $07AF +BORDER equ $0FAF +PAGE0 equ $10AF +PAGE1 equ $11AF +PAGE2 equ $12AF +PAGE3 equ $13AF +FMADDR equ $15AF +TMPAGE equ $16AF +T0GPAGE equ $17AF +T1GPAGE equ $18AF +SGPAGE equ $19AF +DMASADDRL equ $1AAF +DMASADDRH equ $1BAF +DMASADDRX equ $1CAF +DMADADDRL equ $1DAF +DMADADDRH equ $1EAF +DMADADDRX equ $1FAF +SYSCONFIG equ $20AF +MEMCONFIG equ $21AF +HSINT equ $22AF +VSINTL equ $23AF +VSINTH equ $24AF +DMALEN equ $26AF +DMACTR equ $27AF +DMASTATUS equ $27AF +DMANUM equ $28AF +FDDVIRT equ $29AF +INTMASK equ $2AAF +CacheConfig equ $2BAF +T0XOFFSL equ $40AF +T0XOFFSH equ $41AF +T0YOFFSL equ $42AF +T0YOFFSH equ $43AF +T1XOFFSL equ $44AF +T1XOFFSH equ $45AF +T1YOFFSL equ $46AF +T1YOFFSH equ $47AF + +; TS parameters +FM_EN equ $10 + +; VIDEO +VID_256X192 equ $00 +VID_320X200 equ $40 +VID_320X240 equ $80 +VID_360X288 equ $C0 +VID_RASTER_BS equ 6 + +VID_ZX equ $00 +VID_16C equ $01 +VID_256C equ $02 +VID_TEXT equ $03 +VID_NOGFX equ $20 +VID_MODE_BS equ 0 + +; PALSEL +PAL_GPAL_MASK equ $0F +PAL_GPAL_BS equ 0 +PAL_T0PAL_MASK equ $30 +PAL_T0PAL_BS equ 4 +PAL_T1PAL_MASK equ $C0 +PAL_T1PAL_BS equ 6 + +; TSU +TSU_T0ZEN equ $04 +TSU_T1ZEN equ $08 +TSU_T0EN equ $20 +TSU_T1EN equ $40 +TSU_SEN equ $80 + +; SYSTEM +SYS_ZCLK3_5 equ $00 +SYS_ZCLK7 equ $01 +SYS_ZCLK14 equ $02 +SYS_ZCLK_BS equ 0 + +SYS_CACHEEN equ $04 + +; MEMORY +MEM_ROM128 equ $01 +MEM_W0WE equ $02 +MEM_W0MAP_N equ $04 +MEM_W0RAM equ $08 + +MEM_LCK512 equ $00 +MEM_LCK128 equ $40 +MEM_LCKAUTO equ $80 +MEM_LCK1024 equ $C0 +MEM_LCK_BS equ 6 + +; INT +INT_VEC_FRAME equ $FF +INT_VEC_LINE equ $FD +INT_VEC_DMA equ $FB + +INT_MSK_FRAME equ $01 +INT_MSK_LINE equ $02 +INT_MSK_DMA equ $04 + +; DMA +DMA_WNR equ $80 +DMA_SALGN equ $20 +DMA_DALGN equ $10 +DMA_ASZ equ $08 +DMA_OPT equ $40 + +DMA_RAM equ $01 +DMA_BLT equ $81 +DMA_BLT2 equ $06 +DMA_FILL equ $04 +DMA_SPI_RAM equ $02 +DMA_RAM_SPI equ $82 +DMA_IDE_RAM equ $03 +DMA_RAM_IDE equ $83 +DMA_RAM_CRAM equ $84 +DMA_RAM_SFILE equ $85 + +; SPRITES +SP_XF equ $80 +SP_YF equ $80 +SP_LEAP equ $40 +SP_ACT equ $20 + +SP_SIZE8 equ $00 +SP_SIZE16 equ $02 +SP_SIZE24 equ $04 +SP_SIZE32 equ $06 +SP_SIZE40 equ $08 +SP_SIZE48 equ $0A +SP_SIZE56 equ $0C +SP_SIZE64 equ $0E +SP_SIZE_BS equ 1 + +SP_PAL_MASK equ $F0 + +SP_XF_W equ $8000 +SP_YF_W equ $8000 +SP_LEAP_W equ $4000 +SP_ACT_W equ $2000 + +SP_SIZE8_W equ $0000 +SP_SIZE16_W equ $0200 +SP_SIZE24_W equ $0400 +SP_SIZE32_W equ $0600 +SP_SIZE40_W equ $0800 +SP_SIZE48_W equ $0A00 +SP_SIZE56_W equ $0C00 +SP_SIZE64_W equ $0E00 +SP_SIZE_BS_W equ 9 + +SP_X_MASK_W equ $01FF +SP_Y_MASK_W equ $01FF +SP_TNUM_MASK_W equ $0FFF +SP_PAL_MASK_W equ $F000 + +; TILES +TL_XF equ $40 +TL_YF equ $80 +TL_PAL_MASK equ $30 +TL_PAL_BS equ 4 + +TL_XF_W equ $4000 +TL_YF_W equ $8000 + +TL_TNUM_MASK_W equ $0FFF +TL_PAL_MASK_W equ $3000 +TL_PAL_BS_W equ 12 diff --git a/_esp/upd1/README!!__eRS232.txt b/_esp/upd1/README!!__eRS232.txt new file mode 100644 index 0000000..3fa4b70 --- /dev/null +++ b/_esp/upd1/README!!__eRS232.txt @@ -0,0 +1,46 @@ +-------------------------------------------------------------------------------- + +Address Mode Name Description +0x00EF..0xBFEF R DR Data register (ZIFI or RS232). + Get byte from input FIFO. + Input FIFO must not be empty (xx_IFR > 0). +0x00EF..0xBFEF W DR Data register (ZIFI or RS232). + Put byte into output FIFO. + Output FIFO must not be full (xx_OFR > 0). + +Address Mode Name Description +0xC0EF R ZF_IFR ZIFI Input FIFO Used Register. Switch DR to ZIFI FIFO. + 0 - input FIFO is empty, 191 - input FIFO contain 191 or more bytes. +0xC1EF R ZF_OFR ZIFI Output FIFO Free Register. Switch DR to ZIFI FIFO. + 0 - output FIFO is full, 191 - output FIFO free 191 or more bytes. +0xC2EF R RS_IFR RS232 Input FIFO Used Register. Switch DR to RS232 FIFO. + 0 - input FIFO is empty, 191 - input FIFO contain 191 or more bytes. +0xC3EF R RS_OFR RS232 Output FIFO Free Register. Switch DR to RS232 FIFO. + 0 - output FIFO is full, 191 - output FIFO free 191 or more bytes. + +Address Mode Name Description +0xC7EF W CR Command register. Command set depends on API mode selected. + + All mode commands: + Code Command Description + 000000oi Clear ZIFI FIFOs + i: 1 - clear input ZIFI FIFO, + o: 1 - clear output ZIFI FIFO. + 000001oi Clear RS232 FIFOs + i: 1 - clear input RS232 FIFO, + o: 1 - clear output RS232 FIFO. + 11110mmm Set API mode or disable API: + 0 API disabled. + 1 transparent: all data is sent/received to/from external UART directly. + 2..7 reserved. + 11111111 Get Version Returns highest supported API version. ER=0xFF - no API available. + +Address Mode Name Description +0xC7EF R ER Error register - command execution result code. Depends on command issued. + + All mode responses: + Code Description + 0x00 OK - no error. + 0xFF REJ - command rejected. + +-------------------------------------------------------------------------------- diff --git a/_esp/upd1/ZiFi/_psb/uart.a80 b/_esp/upd1/ZiFi/_psb/uart.a80 new file mode 100644 index 0000000..0667d0d --- /dev/null +++ b/_esp/upd1/ZiFi/_psb/uart.a80 @@ -0,0 +1,211 @@ + + module uart + + +BASEREG EQU #F8EF + + +;DLAB=0 +THR EQU BASEREG+#000 ;(W)Transmit Holding Register +RBR EQU BASEREG+#000 ;(R)Receive Buffer Register +IER EQU BASEREG+#100 ;(RW)Interrupt Enable Register + +EDSSI EQU %1000 ;Enable Modem Status Interrupt +ELSI EQU %0100 ;Enable Receiver Line Status Interrupt +ETBEI EQU %0010 ;Enable Transmitter Holding Register Empty Interrupt +ERBFI EQU %0001 ;Enable Received Data Available Interrupt + +FCR EQU BASEREG+#200 ;(W)FIFO Control Register +IIR EQU BASEREG+#200 ;(R)Interrupt Identification Register + +LCR EQU BASEREG+#300 ;(RW)Line Control Register + +DLAB EQU %10000000 ;Divisor Latch Access Bit +SETBRK EQU %01000000 ;Set Break +STKPAR EQU %00100000 ;Stick Parity +EPS EQU %00010000 ;Even Parity Select +PEN EQU %00001000 ;Parity Enable +STB EQU %00000100 ;Number of Stop Bits +WLSB1 EQU %00000010 ;Word Length Select #1 +WLSB0 EQU %00000001 ;Word Length Select #0 + +MCR EQU BASEREG+#400 ;(RW)Modem Control Register + +RTS EQU %10 ;Request to Send +DTR EQU %01 ;Data Terminal Ready + +LSR EQU BASEREG+#500 ;(RW)Line Status Register + +FIFOE EQU %10000000 ;Error in Receiver FIFO +TEMT EQU %01000000 ;Transmitter Empty +THRE EQU %00100000 ;Transmitter Holding Register Empty +BI EQU %00010000 ;Break Interrupt (BI) +FE EQU %00001000 ;Framing Error (FE) +PE EQU %00000100 ;Parity Error (PE) +OE EQU %00000010 ;Overrun Error (OE) +DR EQU %00000001 ;Data Ready (DR) + + +MSR EQU BASEREG+#600 ;(RW)Modem Status Register + +DCD EQU %10000000 ;Data Carrier Detect +RI EQU %01000000 ;Ring Indicator +DSR EQU %00100000 ;Data Set Ready +CTS EQU %00010000 ;Clear To Send +DDCD EQU %00001000 ;Delta Data Carrier Detect +TERI EQU %00000100 ;Trailing Edge Ring Indicator +DDSR EQU %00000010 ;Delta Data Set Ready +DCTS EQU %00000001 ;Delta Clear To Send + +SCR EQU BASEREG+#700 ;(RW)Scratch Register + +;DLAB=1 +DLL EQU BASEREG+#000 ;(RW)Divisor Latch LSB +DLH EQU BASEREG+#100 ;(RW)Divisor Latch MSB + + +;eRS232 for ZX-Evo +ERS_DR EQU #00EF +ERS_SR EQU #C2EF +ERS_ST EQU #C3EF +ERS_CR EQU #C7EF + + +;set baud rate +;hl=divider +SetBaud + ld bc,LCR + in a,(c):or DLAB:out (c),a ;set DLAB=1 + + ld b,high DLL + out (c),l ;low + inc b + out (c),h ;high + + ld b,high LCR + in a,(c):and !DLAB:out (c),a ;set DLAB=0 + + ld b,high ERS_CR + ld a,#F1 + out (c),a + ld a,#07 + out (c),a + + ret + + +;set line control register +;a=status +SetLineControl + ld bc,LCR + out (c),a + ret + + +;put char +;a=char +PutChar + ld bc,ERS_ST + exa +pc1 in f,(c):jr z,pc1 ;wait for room + exa + + ld b,high ERS_DR + out (c),a + ret + + + +;get char +;out: a=char +GetChar + ld bc,ERS_SR +gc1 in f,(c):jr z,gc1 ;wait for data + + ld b,high ERS_DR + in a,(c) + ret + + + +;write block +;hl=buffer addr +;bc=len +Write + ld d,b + ld e,c +ww1 ld bc,ERS_ST + in c,(c) + jr z,ww1 + ld a,d + or a + jr nz,ww2 + ld a,e + cp c + jr nc,ww2 + ld c,e +ww2 ex de,hl + xor a + ld b,a + sbc hl,bc + ex de,hl + ld b,c + ld c,low ERS_DR + otir + ld a,d + or e + jr nz,ww1 + ret + +;read block +;hl=buffer addr +;bc=len +Read + ld d,b + ld e,c +rr1 ld bc,ERS_SR + in c,(c) + jr z,rr1 + ld a,d + or a + jr nz,rr2 + ld a,e + cp c + jr nc,rr2 + ld c,e +rr2 ex de,hl + xor a + ld b,a + sbc hl,bc + ex de,hl + ld b,c + ld c,low ERS_DR + inir + ld a,d + or e + jr nz,rr1 + ret + +;;read block fast +;;hl=buffer addr +;;bc=len +;Readf push hl:exx:pop hl +; ld de,high LSR+256*high RBR ;+256 +; +; ld c,low LSR +;r0_ dup 16 +; ld b,e +; in a,(c):and DR:jr z,$-4 ;wait +; +; ld b,d:ini +; edup +; exx +; dup 16 +; dec bc +; edup +; ld a,b:or c +; exx +; jp nz,r0 +; ret + + endmodule diff --git a/_esp/upd1/zifi_eRS_57600.spg b/_esp/upd1/zifi_eRS_57600.spg new file mode 100644 index 0000000..b177c0c Binary files /dev/null and b/_esp/upd1/zifi_eRS_57600.spg differ diff --git a/_esp/upd1/zxevo_fw.bin b/_esp/upd1/zxevo_fw.bin new file mode 100644 index 0000000..46e7b5f Binary files /dev/null and b/_esp/upd1/zxevo_fw.bin differ diff --git a/_esp/upd1/zxevo_fw_vdac.bin b/_esp/upd1/zxevo_fw_vdac.bin new file mode 100644 index 0000000..e093391 Binary files /dev/null and b/_esp/upd1/zxevo_fw_vdac.bin differ diff --git a/_esp/zifi_driver.asm b/_esp/zifi_driver.asm new file mode 100644 index 0000000..874f6a6 --- /dev/null +++ b/_esp/zifi_driver.asm @@ -0,0 +1,625 @@ + device zxspectrum128 + +page_for_download equ #20 + + + org #8000 +start + +im2_init + ld a,#be + ld i,a + ld hl,int_gfx_view + ld (#beff),hl + im 2 + ei +; memory init + ld bc,MEMCONFIG + ld a,%00001110 + out (c),a + xor a + call set_page0 + ld a,4 + out (#fe),a + + call init_zifi + ld a,1 + out (#fe),a +; create http + ld hl,test_url + call parse_url + +; set page for download data + ld a,page_for_download + ld (zipd_page+1),a + ld hl,#0000 ; start adress + ld (zipd_adr+1),hl + call get_url + ld a,5 + out (#fe),a +; lenght of received data: #00 : #0000 + ld a,(readed_len_high+1) ; high byte lenght + ld hl,(readed_len_low+1) ; low word lenght + jr $ + + +test_url db "http://httpbin.org/ip",#0d + +init_zifi ld bc,#c7ef + ld de,#fff1 + out (c),e ;Set API mode 1 + out (c),d ;Get Version + in a,(c) + cp #ff + jp z,nozifi + ld a,#01 + out (c),a ;Clear RX FIFO +2 ld hl,cmd_at + call zifi_send + ld de,str_ok + call buffer_cmp + jr nz,2b + +;ld hl,cmd_uart +; call zifi_send + ld hl,cmd_gmr + call zifi_send + ld hl,cmd_cwmode + call zifi_send + ld hl,cmd_cwautoconn + call zifi_send + ld hl,cmd_cipmux + call zifi_send + ld hl,cmd_cwjap ; AT+CWJAP_CUR . Connect to AP, for current + call zifi_send + +2 call zifi_check_receive_command + ld de,str_ok + call buffer_cmp + jr nz,2b + ret ; we all connected, OK 0:1 + + +nozifi ld hl,conf_not_found_msg ; old rs232 port, cancel + jr $ + +conf_not_found_msg + db "Error: Please update TS Conf.",0 + + + +// send and receive data without header + +get_url ld hl,cmd_conn2site ; AT+CIPSTART - connect to site + call zifi_send + + ld de,str_error + call buffer_cmp + jr nz,zg_ok + + ld hl,cmd_cipclose + call zifi_send +1 ld de,str_ok + call buffer_cmp + jr z,get_url + call wait_frame + call fifo_inir + jr 1b + +zg_ok ld de,str_ok + call buffer_cmp + jr nz,get_url + +1 ld hl,cmd_cipsend ; AT+CIPSEND=, + call zifi_send_raw +2 call fifo_inir + ld de,str_ok + call buffer_cmp + jr nz,2b +1 ld a,(hl) + inc hl + cp #ff + jr z,2b + cp ">" + jr nz,1b + +; send http request + ld hl,modem_command + call zifi_send_raw +1 + call zifi_getchar + cp "O" + jr nz,1b + call zifi_getchar + cp "K" + jr nz,1b + +// receive header +first_ipd + call reread_ipd +2 +; skip data + call read_fifo_char + dec hl + cp #0d + jr nz,2b + call read_fifo_char + dec hl + cp #0a + jr nz,2b + call read_fifo_char + dec hl + cp #0d + jr nz,2b + call read_fifo_char + dec hl + cp #0a + jr nz,2b +// header skipped -------------------- + ld a,h + or l + jr z,read_all_ipds + ld (zipd_full_len+1),hl + jr zipd_adr + +// receive data +read_all_ipds call reread_ipd +zipd_adr ld hl,#0000 ; adress for receive data ---------------------- +zipd_full_len ld de,0 ; ipd len +p231 ld bc,zifi_input_fifo_status +1 in a,(c) + or a ; 0 - input FIFO is empty, + jr z,1b +p232 cp 0xbf ; BIG THANKS FOR DDp for his MIGHTY code! + jr c,p233 ; + ld a,0xbf ; д +p233 ld c,a ; о + ld a,d ; л + or a ; г + jr nz,p234 ; о + ld a,e ; + cp c ; з + jr nc,p234 ; а + ld c,e ; п +p234 ex de,hl ; р + xor a ; я + ld b,a ; г + sbc hl,bc ; а + ex de,hl ; е + ld b,c ; м + ld c,0xef ; + inir ; и быстро едем + ld a,d + or e + jr nz,p231 + ld a,h + cp #40 + jr c,1f +zipd_page ld a,0 + inc a + ld (zipd_page+1),a + call set_page0 + inc a + call set_page1 + ld a,h + sub #40 + ld h,a +1 ld (zipd_adr+1),hl + + ld hl,(zipd_full_len+1) + ld b,h +readed_len_low ld de,0 + add hl,de + ld (readed_len_low+1),hl + jr nc,1f +readed_len_high ld a,0 + inc a + ld (readed_len_high+1),a +1 jp read_all_ipds + + + + +read_fifo_char ld bc,zifi_input_fifo_status ; ждём прихода данных в фифо +3 in a,(c) + jr z,3b ; 0 - input FIFO is empty, + ld b,0 + in a,(c) + ret + + + +reread_ipd ld e,#ff + ld hl,output_buff + call rdipd + ld de,CLOSED + call buffer_cmp +; or a ; CLOSED, exit + jp z,zifi_read_ipd_ex + ld de,str_ipd + call buffer_cmp + jr nz,reread_ipd + ex de,hl + call count_ipd_lenght ; in HL - lenght of ipd packet + ld (zipd_full_len+1),hl + ret + +zifi_read_ipd_ex + pop af + ld a,(readed_len_high+1) + ld c,a + ld hl,(readed_len_low+1) + ret + +rdipd: call zifi_getchar + jr z,rdipd + ld (hl),a + inc hl + cp ':' + ret z + cp #0a + ret z + jr rdipd + +zifi_getchar: + call zifi_input_fifo_check + or a + jr z,zifi_getchar + ld b,0 + in a,(c) + dec b + ret + +count_ipd_lenght + ld hl,0 ; count lenght +cil1 ld a,(de) + inc de + cp ':' + ret z + sub 0x30 + ld c,l + ld b,h + add hl,hl + add hl,hl + add hl,bc + add hl,hl + ld c,a + ld b,0 + add hl,bc + jr cil1 + + +ss_cmp ld hl,output_buff +ss_cm1 ld a,(de) + or a + ret z + inc de + cpi + jr z,ss_cm1 + ret + + +read_pack + ld bc,zifi_input_fifo_status ; ждём прихода данных в фифо + ld hl,0 +1 dec hl + ld a,h + or a + jr z,zifi_read_ipd_ex + in a,(c) + or a ; 0 - input FIFO is empty, + jr z,1b + ld hl,output_buff ; in E - lenght + + +fifo_inir push de + call zifi_input_fifo_check + ld hl,output_buff ; read data from fifo, count: #bf + push hl + ld bc,zifi_data_reg + inir + pop hl + pop de + ret + +zifi_send call zifi_send_raw +zifi_check_receive_command jp fifo_inir + + + +buffer_cmp ld hl,output_buff +data_cmp ld (buffer_cmp_start+1),de + ld c,low output_buff+#bf +buffer_cmp_start + ld de,0 +buffer_cmp0 ld a,(de) + cp (hl) + jr z,buffer_cmp1 + ld a,l + cp c + jr z,buffer_cmp_notfound + inc hl + jr buffer_cmp0 +buffer_cmp_notfound + or a + ret + +buffer_cmp1 inc de + inc hl + ld a,(de) + or a + ret z + cp (hl) + jr nz,buffer_cmp_start + jr buffer_cmp1 + + +zifi_send_raw call check_output_fifo_status + call clear_output_fifo + push hl + ld hl,output_buff + ld de,output_buff+1 + ld bc,#ef + ld (hl),l + ldir + pop hl + + ld bc,zifi_data_reg +1 ld a,(hl) + or a + ret z + out (c),a + inc hl + jr 1b + + + +zifi_input_fifo_check + ld bc,zifi_input_fifo_status ; ждём прихода данных в фифо + ld e,0 +3 in a,(c) + or a ; 0 - input FIFO is empty, + ret nz + call wait_frame + dec e + jr nz,3b +error ld a,2 + out (#fe),a + ret + + +clear_output_fifo ld a,cmd_clear_output_fifo + call zifi_out_command +check_output_fifo_status + ld bc,zifi_output_fifo_status +cofs in a,(c) + or a + jr z,cofs ; 0 - output FIFO is full + ret + +clear_input_fifo ld a,cmd_clear_input_fifo + call zifi_out_command + ld bc,zifi_input_fifo_status +clear_input_fifo1 in a,(c) + or a + jr nz,clear_input_fifo1 ;0 - input FIFO is empty + ret + + +zifi_out_command ld bc,zifi_command_reg + out (c),a + ret + +zifi_command_result ld bc,zifi_error_reg + in a,(c) + ret + +; in hl - adress: +; http://zxaaa.untergrund.net/get.php?f=DEMO6/a_brief_history_of_vacuum_cleaner_nozzle_attachments.zip + +parse_url ld de,cmd_conn2site_adr +pu1 ld a,(hl) ; http:// + inc hl + cp "/" + jr nz,pu1 + inc hl ; / + ld bc,"//" + ld (host_url+1),hl + call find_copy_char + inc hl + ld (file_url+1),hl +; ld c,#0d +; call find_copy_char + +create_link1 ld hl,create_link_suffix + ld bc,7 + ldir + ld hl,modem_command + + ld (hl),"G" + inc hl + ld (hl),"E" + inc hl + ld (hl),"T" + inc hl + ld (hl)," " + inc hl + ld (hl),"/" + inc hl + + ex hl,de +file_url ld hl,0 + ld bc,#0d0a + call find_copy_char + ld hl,http_part1 + ld bc,http_part2-http_part1 + ldir +host_url ld hl,0 + ld bc,"//" + call find_copy_char + ld a,13 + ld (de),a + inc de + ld a,10 + ld (de),a + inc de + ld hl,http_part2 + ld bc,http_part3-http_part2 + ldir +; dec de + ex de,hl + ld de,modem_command + or a + sbc hl,de +; inc hl + ld de,url_len + ld bc,-1000 + call Num1 + cp "0" + jr z,1f + ld (de),a + inc de +1 ld bc,-100 + call Num1 + ld (de),a + inc de +1 ld c,-10 + call Num1 + ld (de),a + inc de +1 ld c,-1 + call Num1 + ld (de),a + inc de + ld a,#0d + ld (de),a + inc de + ld a,#0a + ld (de),a + inc de + xor a + ld (de),a + ret + +Num1: ld a,'0'-1 +Num2: inc a + add hl,bc + jr c,Num2 + sbc hl,bc + ret + +find_copy_char ld a,(hl) + cp c + ret z + cp b + ret z + ld (de),a + inc hl + inc de + jr find_copy_char + +create_link_suffix + db #22,",80",13,10,0 + + + +set_page0 ld bc,PAGE0 + out (c),a + ret + +set_page1 ld bc,PAGE1 + out (c),a + ret + + +wait_frame ld a,(frame+1) + or a + jr z,wait_frame + xor a + ld (frame+1),a + ret + +int_gfx_view push af,hl,de,bc +frame ld a,0 + inc a + ld (frame+1),a + pop bc,de,hl,af + ei + ret + + +zifi_command_reg equ #C7EF +zifi_error_reg equ #C7EF +zifi_data_reg equ #BFEF +zifi_input_fifo_status equ #C0EF +zifi_output_fifo_status equ #C1EF + + +cmd_clear_input_fifo equ 1 +cmd_clear_output_fifo equ 2 + +modem_command ds 256+128 + +CLOSED db "CLOSED",#0d,#0a,0 + +http_part1 db " HTTP/1.0",13,10 ;size=123 + db "Host: " ;zxart.ee",13,10 + +http_part2 db "User-Agent: ZiFi (ZX Evo)",13,10 ; show off ;) + db "Accept: */*",13,10 + db "Connection: close",13,10,13,10 +http_part3 + + +; init esp8266 +cmd_at: defb "ATE0",13,10,0 +cmd_gmr: defb "AT+GMR",13,10,0 ; 3. AT+GMR – View version info + ;This AT command is used to check the version of AT commands and SDK that you are using, the type of which is "executed". +cmd_uart db "AT+UART_CUR=115200,8,1,0,3",13,10,0 +cmd_cwmode: defb "AT+CWMODE_DEF=1",13,10,0 ; Wi-Fi default mode(sta/AP/sta+AP) Save to Flash +cmd_cipmux db "AT+CIPMUX=0",13,10,0 ; Выбрать режим одиночного или множественных подключений +cmd_cwautoconn: defb "AT+CWAUTOCONN=0",13,10,0 ; Connect to AP automatically when power on +cmd_cwqap: defb "AT+CWQAP",13,10,0 ; Disconnect from AP +cmd_cwlap: defb "AT+CWLAP",13,10,0 ; Lists available APs + +cmd_cwjap: defb "AT+CWJAP_CUR=",0x22 ; Connect to AP, won’t save to Flash +cmd_cwjap_ap defb "YV" ; SSID + defb #22,#2c,#22 +cmd_cwjap_pass defb "1234123412" ; password + defb #22,#0d,#0a + +cmd_cipsta: defb "AT+CIPSTA?",13,10,0 ; AT+CIPSTA – Set IP address of station +cmd_cipclose db "AT+CIPCLOSE",13,10,0 +; load data from server +cmd_conn2site defb "AT+CIPSTART=" +;cmd_conn2site_task_num db "0," + db 0x22,"TCP",0x22,",",0x22 + ;AT+CIPSTART – Establish TCP connection or UDP transmission + ;AT+CIPMODE – Set transfer mode ------!!!------ + ; UART-WiFi passthrough mode (transparent transmission) can only be enabled in TCP single + ; connection mode or UDP of which remote IP and port won’t change (parameter is 0 + ; when using command “AT+CIPSTART” to create a UDP transmission) . +cmd_conn2site_adr ds #40 ; defb "zxart.ee" ; site + ; defb 0x22,",80",13,10 + +cmd_cipsend db "AT+CIPSEND=" +;download_task_num db "0," +url_len ds 6 + db 0 + +str_ok: defb "OK",13,0 +str_already_con:defb "ALREADY CONNECT",13,0 +str_error: defb "ERROR",13,0 +str_fail: defb "FAIL",13,0 +str_send_ok: defb "SEND OK",13,0 +str_ipd db "+IPD,",0 + + include "tsconfig.asm" + + align 256 +output_buff +end + + + + SAVEBIN "_spg/zifi_driver.bin",start, end-start \ No newline at end of file diff --git a/_pt/PTSPlay.asm b/_pt/PTSPlay.asm new file mode 100644 index 0000000..1004235 --- /dev/null +++ b/_pt/PTSPlay.asm @@ -0,0 +1,1697 @@ + ifndef _pts_asm_defined + define _pts_asm_defined + + MODULE PTS + +;Universal PT2'n'PT3 Turbo Sound player for ZX Spectrum +;(c)2004-2007 S.V.Bulba +;Specially for AlCo +;http://bulba.untergrund.net/ (http://bulba.at.kz/) + +;Release number +Release EQU "0" + +;Conditional assembly +;1) Current position counters at (Vars1+0) and (Vars2+0) +CurPosCounter=0 +;2) Allow channels allocation bits at (SETUP) +ACBBAC=0 +;3) Allow loop checking and disabling +LoopChecker=0 +;4) Insert official identificator +Id=0 +;5) Set IY for correct return to ZX Basic +Basic=0 + +;Features +;-------- +;-Can be compiled at any address (i.e. no need rounding ORG +; address). +;-Variables (VARS) can be located at any address (not only after +; code block). +;-INIT subprogram checks PT3-module version and rightly +; generates both note and volume tables outside of code block +; (in VARS). +;-Two portamento (spc. command 3xxx) algorithms (depending of +; PT3 module version). +;-New 1.XX and 2.XX special command behaviour (only for PT v3.7 +; and higher). +;-Any Tempo value are accepted (including Tempo=1 and Tempo=2). +;-TS modes: 2xPT3, 2xPT2 and PT v3.7 TS standard. +;-Fully compatible with Ay_Emul PT3 and PT2 players codes. +;-See also notes at the end of this source code. + +;Limitations +;----------- +;-Can run in RAM only (self-modified code is used). +;-PT2 position list must be end by #FF marker only. + +;Warning!!! PLAY subprogram can crash if no module are loaded +;into RAM or INIT subprogram was not called before. + +;Call MUTE or INIT one more time to mute sound after stopping +;playing + +TonA EQU 0 +TonB EQU 2 +TonC EQU 4 +Noise EQU 6 +Mixer EQU 7 +AmplA EQU 8 +AmplB EQU 9 +AmplC EQU 10 +Env EQU 11 +EnvTp EQU 13 + +START + +SETUP.NOLOOP EQU 1 +SETUP.PT2 EQU 2 +SETUP.ACB EQU 4 +SETUP.BAC EQU 8 +SETUP.TS02 EQU 16 +SETUP.TSPT3 EQU 32 + +SETUP DB 0 ;set bit0, if you want to play without looping + ;(optional); + ;set bit1 for PT2 and reset for PT3 before + ;calling INIT; + ;bits2-3: %00-ABC, %01-ACB, %10-BAC (optional); + ;bits4-5: %00-no TS, %01-2 modules TS, %10- + ;autodetect PT3 TS-format by AlCo (PT 3.7+); + ;Remark: old PT3 TS-format by AlCo (PT 3.6) is not + ;documented and must be converted to new standard. + ;bit6 is set each time, when loop point of 2nd TS + ;module is passed (optional). + ;bit7 is set each time, when loop point of 1st TS + ;or of single module is passed (optional). + +;Identifier + IF Id + DB "=UniPT2/PT3/TS-Player r.",Release,"=" + ENDIF + + IF LoopChecker +CHECKLP LD HL,SETUP + BIT 0,(IY-100+VRS.ModNum) + JR Z,CHL1 + SET 6,(HL) + JR CHL2 +CHL1 SET 7,(HL) +CHL2 BIT 0,(HL) + RET Z + POP HL + INC (IY-100+VRS.DelyCnt) + INC (IY-100+VRS.ChanA+CHP.NtSkCn) + XOR A + LD (IY-100+VRS.AYREGS+AmplA),A + LD (IY-100+VRS.AYREGS+AmplB),A + LD (IY-100+VRS.AYREGS+AmplC),A + RET + ENDIF + +MUTE XOR A + LD H,A + LD L,A + LD (VARS1+VRS.AYREGS+AmplA),A + LD (VARS1+VRS.AYREGS+AmplB),HL + LD (VARS2+VRS.AYREGS+AmplA),A + LD (VARS2+VRS.AYREGS+AmplB),HL + JP ROUT + +INIT +;HL - AddressOfModule +;DE - AddresOf2ndModule +;A - mode + PUSH DE + PUSH HL + LD HL,VARS + LD (HL),0 + LD DE,VARS+1 + LD BC,VAR0END-VARS-1 + LDIR + INC HL + LD (VARS1+VRS.AdInPtA),HL ;ptr to zero + LD (VARS2+VRS.AdInPtA),HL + + POP HL + LD IY,VARS1+100 + LD (SETUP),A + AND SETUP.PT2 + JP NZ,I_PT2 + + CALL INITPT3 + LD HL,(e_-SamCnv-2)*256+#18 + LD (SamCnv),HL + LD A,#BA + LD (OrnCP),A + LD (SamCP),A + LD A,#7B + LD (OrnLD),A + LD (SamLD),A + LD A,#87 + LD (SamClc2),A + POP HL + ;Use version and ton table of 1st module + LD A,(IX+13-100) ;EXTRACT VERSION NUMBER + SUB #30 + JR C,L20 + CP 10 + JR C,L21 +L20 LD A,6 +L21 LD (Version),A + PUSH AF ;VolTable version + CP 4 + LD A,(IX+99-100) ;TONE TABLE NUMBER + RLA + AND 7 + PUSH AF ;NoteTable number + + LD IY,VARS2+100 + LD A,(SETUP) + AND SETUP.TS02|SETUP.TSPT3 + JR Z,NOTS + CP SETUP.TS02 + JR Z,TwoPT3s + LD A,(Version) + CP 7 + JR C,NOTS + LD A,(IX+98-100) ;ALCO TS MARKER + CP #20 + JR Z,NOTS + LD HL,VARS1 + LD DE,VARS2 + LD BC,VRS + LDIR + SET 1,(IY-100+VRS.ModNum) + LD C,A + ADD A,A + ADD A,C + SUB 2 + LD (TSSub),A + JR AlCoTS_ +TwoPT3s CALL INITPT3 +AlCoTS_ LD A,1 + LD (is_ts),A + SET 0,(IY-100+VRS.ModNum) + +NOTS LD BC,PT3PD + LD HL,0 + LD DE,PT3EMPTYORN + JR INITCOMMON + +I_PT2 CALL INITPT2 + LD HL,#51CB + LD (SamCnv),HL + LD A,#BB + LD (OrnCP),A + LD (SamCP),A + LD A,#7A + LD (OrnLD),A + LD (SamLD),A + LD A,#80 + LD (SamClc2),A + POP HL + LD A,5 + LD (Version),A + PUSH AF + LD A,2 + PUSH AF + + LD A,(SETUP) + AND SETUP.TS02|SETUP.TSPT3 + JR Z,NOTS2 + + LD IY,VARS2+100 + LD A,1 + LD (is_ts),A + SET 0,(IY-100+VRS.ModNum) + CALL INITPT2 + +NOTS2 LD BC,PT2PD + LD HL,#8687 + LD DE,PT2EMPTYORN + +INITCOMMON + + IF Basic + LD IY,#5C3A + ENDIF + + LD (PTDEC),BC + LD (PsCalc),HL + PUSH DE + +;note table data depacker +;(c) Ivan Roshin + LD DE,T_PACK + LD BC,T1_+(2*49)-1 +TP_0 LD A,(DE) + INC DE + CP 15*2 + JR NC,TP_1 + LD H,A + LD A,(DE) + LD L,A + INC DE + JR TP_2 +TP_1 PUSH DE + LD D,0 + LD E,A + ADD HL,DE + ADD HL,DE + POP DE +TP_2 LD A,H + LD (BC),A + DEC BC + LD A,L + LD (BC),A + DEC BC + SUB (#F8*2)&255 + JR NZ,TP_0 + + INC A + LD (VARS1+VRS.DelyCnt),A + LD (VARS2+VRS.DelyCnt),A + LD HL,#F001 ;H - CHP.Volume, L - CHP.NtSkCn + LD (VARS1+VRS.ChanA+CHP.NtSkCn),HL + LD (VARS1+VRS.ChanB+CHP.NtSkCn),HL + LD (VARS1+VRS.ChanC+CHP.NtSkCn),HL + LD (VARS2+VRS.ChanA+CHP.NtSkCn),HL + LD (VARS2+VRS.ChanB+CHP.NtSkCn),HL + LD (VARS2+VRS.ChanC+CHP.NtSkCn),HL + POP HL + LD (VARS1+VRS.ChanA+CHP.OrnPtr),HL + LD (VARS1+VRS.ChanB+CHP.OrnPtr),HL + LD (VARS1+VRS.ChanC+CHP.OrnPtr),HL + LD (VARS2+VRS.ChanA+CHP.OrnPtr),HL + LD (VARS2+VRS.ChanB+CHP.OrnPtr),HL + LD (VARS2+VRS.ChanC+CHP.OrnPtr),HL + + POP AF + +;NoteTableCreator (c) Ivan Roshin +;A - NoteTableNumber*2+VersionForNoteTable +;(xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0) + + LD HL,NT_DATA + LD D,0 + ADD A,A + LD E,A + ADD HL,DE + LD E,(HL) + INC HL + SRL E + SBC A,A + AND #A7 ;#00 (NOP) or #A7 (AND A) + LD (L3),A + EX DE,HL + LD BC,T1_ + ADD HL,BC + + LD A,(DE) + ADD A,T_&255 + LD C,A + ADC A,T_/256 + SUB C + LD B,A + PUSH BC + LD DE,NT_ + PUSH DE + + LD B,12 +L1 PUSH BC + LD C,(HL) + INC HL + PUSH HL + LD B,(HL) + + PUSH DE + EX DE,HL + LD DE,23 + LD IXH,8 + +L2 SRL B + RR C +L3 DB #19 ;AND A or NOP + LD A,C + ADC A,D ;=ADC 0 + LD (HL),A + INC HL + LD A,B + ADC A,D + LD (HL),A + ADD HL,DE + DEC IXH + JR NZ,L2 + + POP DE + INC DE + INC DE + POP HL + INC HL + POP BC + DJNZ L1 + + POP HL + POP DE + + LD A,E + CP TCOLD_1&255 + JR NZ,CORR_1 + LD A,#FD + LD (NT_+#2E),A + +CORR_1 LD A,(DE) + AND A + JR Z,TC_EXIT + RRA + PUSH AF + ADD A,A + LD C,A + ADD HL,BC + POP AF + JR NC,CORR_2 + DEC (HL) + DEC (HL) +CORR_2 INC (HL) + AND A + SBC HL,BC + INC DE + JR CORR_1 + +TC_EXIT + + POP AF + +;VolTableCreator (c) Ivan Roshin +;A - VersionForVolumeTable (0..4 - 3.xx..3.4x; + ;5.. - 2.x,3.5x..3.6x..VTII1.0) + + CP 5 + LD HL,#11 + LD D,H + LD E,H + LD A,#17 + JR NC,M1 + DEC L + LD E,L + XOR A +M1 LD (M2),A + + LD IX,VT_+16 + + LD C,#F +INITV2 PUSH HL + + ADD HL,DE + EX DE,HL + SBC HL,HL + + LD B,#10 +INITV1 LD A,L +M2 DB #7D + LD A,H + ADC A,0 + LD (IX),A + INC IX + ADD HL,DE + DJNZ INITV1 + + POP HL + LD A,E + CP #77 + JR NZ,M3 + INC E +M3 DEC C + JR NZ,INITV2 + + JP ROUT + +INITPT3 CALL SETMDAD + PUSH HL + LD DE,100 + ADD HL,DE + LD A,(HL) + LD (IY-100+VRS.Delay),A + PUSH HL + POP IX + ADD HL,DE + CALL SETCPPT + LD E,(IX+102-100) + INC HL + + IF CurPosCounter + LD (IY-100+VRS.PosSub),L + ENDIF + + ADD HL,DE + CALL SETLPPT + POP DE + LD L,(IX+103-100) + LD H,(IX+104-100) + ADD HL,DE + CALL SETPTPT + LD HL,169 + ADD HL,DE + CALL SETORPT + LD HL,105 + ADD HL,DE + +SETSMPT LD (IY-100+VRS.SamPtrs),L + LD (IY-100+VRS.SamPtrs+1),H + RET + +INITPT2 LD A,(HL) + LD (IY-100+VRS.Delay),A + PUSH HL + PUSH HL + PUSH HL + INC HL + INC HL + LD A,(HL) + INC HL + CALL SETSMPT + LD E,(HL) + INC HL + LD D,(HL) + POP HL + AND A + SBC HL,DE + CALL SETMDAD + POP HL + LD DE,67 + ADD HL,DE + CALL SETORPT + LD E,32 + ADD HL,DE + LD C,(HL) + INC HL + LD B,(HL) + LD E,30 + ADD HL,DE + CALL SETCPPT + LD E,A + INC HL + + IF CurPosCounter + LD (IY-100+VRS.PosSub),L + ENDIF + + ADD HL,DE + CALL SETLPPT + POP HL + ADD HL,BC + +SETPTPT LD (IY-100+VRS.PatsPtr),L + LD (IY-100+VRS.PatsPtr+1),H + RET + +SETMDAD LD (IY-100+VRS.MODADDR),L + LD (IY-100+VRS.MODADDR+1),H + RET + +SETORPT LD (IY-100+VRS.OrnPtrs),L + LD (IY-100+VRS.OrnPtrs+1),H + RET + +SETCPPT LD (IY-100+VRS.CrPsPtr),L + LD (IY-100+VRS.CrPsPtr+1),H + RET + +SETLPPT LD (IY-100+VRS.LPosPtr),L + LD (IY-100+VRS.LPosPtr+1),H + RET + +SETENBS LD (IY-100+VRS.EnvBase),L + LD (IY-100+VRS.EnvBase+1),H + RET + +SETESLD LD (IY-100+VRS.CurESld),L + LD (IY-100+VRS.CurESld+1),H + RET + +GETIX PUSH IY + POP IX + ADD IX,DE + RET + +PTDECOD CALL GETIX +PTDEC EQU $+1 + JP #C3C3 + +;PT2 pattern decoder +PD2_SAM CALL SETSAM + JR PD2_LOOP + +PD2_EOff LD (IX-12+CHP.Env_En),A + JR PD2_LOOP + +PD2_ENV LD (IX-12+CHP.Env_En),16 + LD (IY-100+VRS.AYREGS+EnvTp),A + LD A,(BC) + INC BC + LD L,A + LD A,(BC) + INC BC + LD H,A + CALL SETENBS + JR PD2_LOOP + +PD2_ORN CALL SETORN + JR PD2_LOOP + +PD2_SKIP INC A + LD (IX-12+CHP.NNtSkp),A + JR PD2_LOOP + +PD2_VOL RRCA + RRCA + RRCA + RRCA + LD (IX-12+CHP.Volume),A + JR PD2_LOOP + +PD2_DEL CALL C_DELAY + JR PD2_LOOP + +PD2_GLIS SET 2,(IX-12+CHP.Flags) + INC A + LD (IX-12+CHP.TnSlDl),A + LD (IX-12+CHP.TSlCnt),A + LD A,(BC) + INC BC + LD (IX-12+CHP.TSlStp),A + ADD A,A + SBC A,A + LD (IX-12+CHP.TSlStp+1),A + SCF + JR PD2_LP2 + +PT2PD AND A + +PD2_LP2 EX AF,AF' + +PD2_LOOP LD A,(BC) + INC BC + ADD A,#20 + JR Z,PD2_REL + JR C,PD2_SAM + ADD A,96 + JR C,PD2_NOTE + INC A + JR Z,PD2_EOff + ADD A,15 + JP Z,PD_FIN + JR C,PD2_ENV + ADD A,#10 + JR C,PD2_ORN + ADD A,#40 + JR C,PD2_SKIP + ADD A,#10 + JR C,PD2_VOL + INC A + JR Z,PD2_DEL + INC A + JR Z,PD2_GLIS + INC A + JR Z,PD2_PORT + INC A + JR Z,PD2_STOP + LD A,(BC) + INC BC + LD (IX-12+CHP.CrNsSl),A + JR PD2_LOOP + +PD2_PORT RES 2,(IX-12+CHP.Flags) + LD A,(BC) + INC BC + INC BC ;ignoring precalc delta to right sound + INC BC + SCF + JR PD2_LP2 + +PD2_STOP LD (IX-12+CHP.TSlCnt),A + JR PD2_LOOP + +PD2_REL LD (IX-12+CHP.Flags),A + JR PD2_EXIT + +PD2_NOTE LD L,A + LD A,(IX-12+CHP.Note) + LD (PrNote+1),A + LD (IX-12+CHP.Note),L + XOR A + LD (IX-12+CHP.TSlCnt),A + SET 0,(IX-12+CHP.Flags) + EX AF,AF' + JR NC,NOGLIS2 + BIT 2,(IX-12+CHP.Flags) + JR NZ,NOPORT2 + LD (LoStep),A + ADD A,A + SBC A,A + EX AF,AF' + LD H,A + LD L,A + INC A + CALL SETPORT +NOPORT2 LD (IX-12+CHP.TSlCnt),1 +NOGLIS2 XOR A + + +PD2_EXIT LD (IX-12+CHP.PsInSm),A + LD (IX-12+CHP.PsInOr),A + LD (IX-12+CHP.CrTnSl),A + LD (IX-12+CHP.CrTnSl+1),A + JP PD_FIN + +;PT3 pattern decoder +PD_OrSm LD (IX-12+CHP.Env_En),0 + CALL SETORN +PD_SAM_ LD A,(BC) + INC BC + RRCA + +PD_SAM CALL SETSAM + JR PD_LOOP + +PD_VOL RRCA + RRCA + RRCA + RRCA + LD (IX-12+CHP.Volume),A + JR PD_LP2 + +PD_EOff LD (IX-12+CHP.Env_En),A + LD (IX-12+CHP.PsInOr),A + JR PD_LP2 + +PD_SorE DEC A + JR NZ,PD_ENV + LD A,(BC) + INC BC + LD (IX-12+CHP.NNtSkp),A + JR PD_LP2 + +PD_ENV CALL SETENV + JR PD_LP2 + +PD_ORN CALL SETORN + JR PD_LOOP + +PD_ESAM LD (IX-12+CHP.Env_En),A + LD (IX-12+CHP.PsInOr),A + CALL NZ,SETENV + JR PD_SAM_ + +PT3PD LD A,(IX-12+CHP.Note) + LD (PrNote+1),A + LD L,(IX-12+CHP.CrTnSl) + LD H,(IX-12+CHP.CrTnSl+1) + LD (PrSlide+1),HL + +PD_LOOP LD DE,#2010 +PD_LP2 LD A,(BC) + INC BC + ADD A,E + JR C,PD_OrSm + ADD A,D + JR Z,PD_FIN + JR C,PD_SAM + ADD A,E + JR Z,PD_REL + JR C,PD_VOL + ADD A,E + JR Z,PD_EOff + JR C,PD_SorE + ADD A,96 + JR C,PD_NOTE + ADD A,E + JR C,PD_ORN + ADD A,D + JR C,PD_NOIS + ADD A,E + JR C,PD_ESAM + ADD A,A + LD E,A + LD HL,(SPCCOMS+#FF20-#2000)&65535 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + PUSH DE + JR PD_LOOP + +PD_NOIS LD (IY-100+VRS.Ns_Base),A + JR PD_LP2 + +PD_REL RES 0,(IX-12+CHP.Flags) + JR PD_RES + +PD_NOTE LD (IX-12+CHP.Note),A + SET 0,(IX-12+CHP.Flags) + XOR A + +PD_RES LD (PDSP_+1),SP + LD SP,IX + LD H,A + LD L,A + PUSH HL + PUSH HL + PUSH HL + PUSH HL + PUSH HL + PUSH HL +PDSP_ LD SP,#3131 + +PD_FIN LD A,(IX-12+CHP.NNtSkp) + LD (IX-12+CHP.NtSkCn),A + RET + +C_PORTM LD A,(BC) + INC BC +;SKIP PRECALCULATED TONE DELTA (BECAUSE +;CANNOT BE RIGHT AFTER PT3 COMPILATION) + INC BC + INC BC + EX AF,AF' + LD A,(BC) ;SIGNED TONE STEP + INC BC + LD (LoStep),A + LD A,(BC) + INC BC + AND A + EX AF,AF' + LD L,(IX-12+CHP.CrTnSl) + LD H,(IX-12+CHP.CrTnSl+1) + +;Set portamento variables +;A - Delay; A' - Hi(Step); ZF' - (A'=0); HL - CrTnSl + +SETPORT RES 2,(IX-12+CHP.Flags) + LD (IX-12+CHP.TnSlDl),A + LD (IX-12+CHP.TSlCnt),A + PUSH HL + LD DE,NT_ + LD A,(IX-12+CHP.Note) + LD (IX-12+CHP.SlToNt),A + ADD A,A + LD L,A + LD H,0 + ADD HL,DE + LD A,(HL) + INC HL + LD H,(HL) + LD L,A + PUSH HL +PrNote LD A,#3E + LD (IX-12+CHP.Note),A + ADD A,A + LD L,A + LD H,0 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + POP HL + SBC HL,DE + LD (IX-12+CHP.TnDelt),L + LD (IX-12+CHP.TnDelt+1),H + POP DE +Version EQU $+1 + LD A,#3E + CP 6 + JR C,OLDPRTM ;Old 3xxx for PT v3.5- +PrSlide LD DE,#1111 + LD (IX-12+CHP.CrTnSl),E + LD (IX-12+CHP.CrTnSl+1),D +LoStep EQU $+1 +OLDPRTM LD A,#3E + EX AF,AF' + JR Z,NOSIG + EX DE,HL +NOSIG SBC HL,DE + JP P,SET_STP + CPL + EX AF,AF' + NEG + EX AF,AF' +SET_STP LD (IX-12+CHP.TSlStp+1),A + EX AF,AF' + LD (IX-12+CHP.TSlStp),A + LD (IX-12+CHP.COnOff),0 + RET + +C_GLISS SET 2,(IX-12+CHP.Flags) + LD A,(BC) + INC BC + LD (IX-12+CHP.TnSlDl),A + AND A + JR NZ,GL36 + LD A,(Version) ;AlCo PT3.7+ + CP 7 + SBC A,A + INC A +GL36 LD (IX-12+CHP.TSlCnt),A + LD A,(BC) + INC BC + EX AF,AF' + LD A,(BC) + INC BC + JR SET_STP + +C_SMPOS LD A,(BC) + INC BC + LD (IX-12+CHP.PsInSm),A + RET + +C_ORPOS LD A,(BC) + INC BC + LD (IX-12+CHP.PsInOr),A + RET + +C_VIBRT LD A,(BC) + INC BC + LD (IX-12+CHP.OnOffD),A + LD (IX-12+CHP.COnOff),A + LD A,(BC) + INC BC + LD (IX-12+CHP.OffOnD),A + XOR A + LD (IX-12+CHP.TSlCnt),A + LD (IX-12+CHP.CrTnSl),A + LD (IX-12+CHP.CrTnSl+1),A + RET + +C_ENGLS LD A,(BC) + INC BC + LD (IY-100+VRS.Env_Del),A + LD (IY-100+VRS.CurEDel),A + LD A,(BC) + INC BC + LD L,A + LD A,(BC) + INC BC + LD H,A + LD (IY-100+VRS.ESldAdd),L + LD (IY-100+VRS.ESldAdd+1),H + RET + +C_DELAY LD A,(BC) + INC BC + LD (IY-100+VRS.Delay),A + LD HL,VARS2+VRS.ModNum ;if AlCo_TS + BIT 1,(HL) + RET Z + LD (VARS1+VRS.Delay),A + LD (VARS1+VRS.DelyCnt),A + LD (VARS2+VRS.Delay),A + RET + +SETENV LD (IX-12+CHP.Env_En),E + LD (IY-100+VRS.AYREGS+EnvTp),A + LD A,(BC) + INC BC + LD H,A + LD A,(BC) + INC BC + LD L,A + CALL SETENBS + XOR A + LD (IX-12+CHP.PsInOr),A + LD (IY-100+VRS.CurEDel),A + LD H,A + LD L,A + JP SETESLD + +SETORN ADD A,A + LD E,A + LD D,0 + LD (IX-12+CHP.PsInOr),D + LD L,(IY-100+VRS.OrnPtrs) + LD H,(IY-100+VRS.OrnPtrs+1) + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + LD L,(IY-100+VRS.MODADDR) + LD H,(IY-100+VRS.MODADDR+1) + ADD HL,DE + LD (IX-12+CHP.OrnPtr),L + LD (IX-12+CHP.OrnPtr+1),H +C_NOP RET + +SETSAM ADD A,A + LD E,A + LD D,0 + LD L,(IY-100+VRS.SamPtrs); + LD H,(IY-100+VRS.SamPtrs+1); + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + LD L,(IY-100+VRS.MODADDR) + LD H,(IY-100+VRS.MODADDR+1) + ADD HL,DE + LD (IX-12+CHP.SamPtr),L + LD (IX-12+CHP.SamPtr+1),H + RET + +;ALL 16 ADDRESSES TO PROTECT FROM BROKEN PT3 MODULES +SPCCOMS DW C_NOP + DW C_GLISS + DW C_PORTM + DW C_SMPOS + DW C_ORPOS + DW C_VIBRT + DW C_NOP + DW C_NOP + DW C_ENGLS + DW C_DELAY + DW C_NOP + DW C_NOP + DW C_NOP + DW C_NOP + DW C_NOP + DW C_NOP + +CHREGS CALL GETIX + XOR A + LD (Ampl),A + BIT 0,(IX+CHP.Flags) + PUSH HL + JP Z,CH_EXIT + LD (CSP_+1),SP + LD L,(IX+CHP.OrnPtr) + LD H,(IX+CHP.OrnPtr+1) + LD SP,HL + POP DE + LD H,A + LD A,(IX+CHP.PsInOr) + LD L,A + ADD HL,SP + INC A + ;PT2 PT3 +OrnCP INC A ;CP E CP D + JR C,CH_ORPS +OrnLD DB 1 ;LD A,D LD A,E +CH_ORPS LD (IX+CHP.PsInOr),A + LD A,(IX+CHP.Note) + ADD A,(HL) + JP P,CH_NTP + XOR A +CH_NTP CP 96 + JR C,CH_NOK + LD A,95 +CH_NOK ADD A,A + EX AF,AF' + LD L,(IX+CHP.SamPtr) + LD H,(IX+CHP.SamPtr+1) + LD SP,HL + POP DE + LD H,0 + LD A,(IX+CHP.PsInSm) + LD B,A + ADD A,A +SamClc2 ADD A,A ;or ADD A,B for PT2 + LD L,A + ADD HL,SP + LD SP,HL + LD A,B + INC A + ;PT2 PT3 +SamCP INC A ;CP E CP D + JR C,CH_SMPS +SamLD DB 1 ;LD A,D LD A,E +CH_SMPS LD (IX+CHP.PsInSm),A + POP BC + POP HL + +;Convert PT2 sample to PT3 + ;PT2 PT3 +SamCnv POP HL ;BIT 2,C JR e_ + POP HL + LD H,B + JR NZ,$+8 + EX DE,HL + AND A + SBC HL,HL + SBC HL,DE + LD D,C + RR C + SBC A,A + CPL + AND #3E + RR C + RR B + AND C + LD C,A + LD A,B + RRA + RRA + RR D + RRA + AND #9F + LD B,A + +e_ LD E,(IX+CHP.TnAcc) + LD D,(IX+CHP.TnAcc+1) + ADD HL,DE + BIT 6,B + JR Z,CH_NOAC + LD (IX+CHP.TnAcc),L + LD (IX+CHP.TnAcc+1),H +CH_NOAC EX DE,HL + EX AF,AF' + ADD A,NT_&255 + LD L,A + ADC A,NT_/256 + SUB L + LD H,A + LD SP,HL + POP HL + ADD HL,DE + LD E,(IX+CHP.CrTnSl) + LD D,(IX+CHP.CrTnSl+1) + ADD HL,DE +CSP_ LD SP,#3131 + EX (SP),HL + XOR A + OR (IX+CHP.TSlCnt) + JR Z,CH_AMP + DEC (IX+CHP.TSlCnt) + JR NZ,CH_AMP + LD A,(IX+CHP.TnSlDl) + LD (IX+CHP.TSlCnt),A + LD L,(IX+CHP.TSlStp) + LD H,(IX+CHP.TSlStp+1) + LD A,H + ADD HL,DE + LD (IX+CHP.CrTnSl),L + LD (IX+CHP.CrTnSl+1),H + BIT 2,(IX+CHP.Flags) + JR NZ,CH_AMP + LD E,(IX+CHP.TnDelt) + LD D,(IX+CHP.TnDelt+1) + AND A + JR Z,CH_STPP + EX DE,HL +CH_STPP SBC HL,DE + JP M,CH_AMP + LD A,(IX+CHP.SlToNt) + LD (IX+CHP.Note),A + XOR A + LD (IX+CHP.TSlCnt),A + LD (IX+CHP.CrTnSl),A + LD (IX+CHP.CrTnSl+1),A +CH_AMP LD A,(IX+CHP.CrAmSl) + BIT 7,C + JR Z,CH_NOAM + BIT 6,C + JR Z,CH_AMIN + CP 15 + JR Z,CH_NOAM + INC A + JR CH_SVAM +CH_AMIN CP -15 + JR Z,CH_NOAM + DEC A +CH_SVAM LD (IX+CHP.CrAmSl),A +CH_NOAM LD L,A + LD A,B + AND 15 + ADD A,L + JP P,CH_APOS + XOR A +CH_APOS CP 16 + JR C,CH_VOL + LD A,15 +CH_VOL OR (IX+CHP.Volume) + ADD A,VT_&255 + LD L,A + ADC A,VT_/256 + SUB L + LD H,A + LD A,(HL) +CH_ENV BIT 0,C + JR NZ,CH_NOEN + OR (IX+CHP.Env_En) +CH_NOEN LD (Ampl),A + BIT 7,B + LD A,C + JR Z,NO_ENSL + RLA + RLA + SRA A + SRA A + SRA A + ADD A,(IX+CHP.CrEnSl) ;SEE COMMENT BELOW + BIT 5,B + JR Z,NO_ENAC + LD (IX+CHP.CrEnSl),A +NO_ENAC ADD A,(IY-100+VRS.AddToEn) ;BUG IN PT3 - NEED WORD HERE + LD (IY-100+VRS.AddToEn),A + JR CH_MIX +NO_ENSL RRA + ADD A,(IX+CHP.CrNsSl) + LD (IY-100+VRS.AddToNs),A + BIT 5,B + JR Z,CH_MIX + LD (IX+CHP.CrNsSl),A +CH_MIX LD A,B + RRA + AND #48 +CH_EXIT OR (IY-100+VRS.AYREGS+Mixer) + RRCA + LD (IY-100+VRS.AYREGS+Mixer),A + POP HL + XOR A + OR (IX+CHP.COnOff) + RET Z + DEC (IX+CHP.COnOff) + RET NZ + XOR (IX+CHP.Flags) + LD (IX+CHP.Flags),A + RRA + LD A,(IX+CHP.OnOffD) + JR C,CH_ONDL + LD A,(IX+CHP.OffOnD) +CH_ONDL LD (IX+CHP.COnOff),A + RET + +PLAY_ XOR A + LD (IY-100+VRS.AddToEn),A + LD (IY-100+VRS.AYREGS+Mixer),A + DEC A + LD (IY-100+VRS.AYREGS+EnvTp),A + DEC (IY-100+VRS.DelyCnt) + JP NZ,PL2 + DEC (IY-100+VRS.ChanA+CHP.NtSkCn) + JR NZ,PL1B + LD C,(IY-100+VRS.AdInPtA) + LD B,(IY-100+VRS.AdInPtA+1) + LD A,(BC) + AND A + JR NZ,PL1A + LD D,A + LD (IY-100+VRS.Ns_Base),A + LD L,(IY-100+VRS.CrPsPtr) + LD H,(IY-100+VRS.CrPsPtr+1) + INC HL + LD A,(HL) + INC A + JR NZ,PLNLP + + IF LoopChecker + CALL CHECKLP + ENDIF + + LD L,(IY-100+VRS.LPosPtr) + LD H,(IY-100+VRS.LPosPtr+1) + LD A,(HL) + INC A +PLNLP CALL SETCPPT + DEC A + BIT 1,(IY-100+VRS.ModNum) + JR Z,NoAlCo +TSSub EQU $+1 + SUB #D6 + CPL +NoAlCo + ;PT2 PT3 +PsCalc DEC A ;ADD A,A NOP + DEC A ;ADD A,(HL) NOP + ADD A,A + LD E,A + RL D + + IF CurPosCounter + LD A,L + SUB (IY-100+VRS.PosSub) + LD (IY-100+VRS.CurPos),A + ENDIF + + LD L,(IY-100+VRS.PatsPtr) + LD H,(IY-100+VRS.PatsPtr+1) + ADD HL,DE + LD E,(IY-100+VRS.MODADDR) + LD D,(IY-100+VRS.MODADDR+1) + LD (PSP_+1),SP + LD SP,HL + POP HL + ADD HL,DE + LD B,H + LD C,L + POP HL + ADD HL,DE + LD (IY-100+VRS.AdInPtB),L + LD (IY-100+VRS.AdInPtB+1),H + POP HL + ADD HL,DE + LD (IY-100+VRS.AdInPtC),L + LD (IY-100+VRS.AdInPtC+1),H +PSP_ LD SP,#3131 +PL1A LD DE,VRS.ChanA+12-100 + CALL PTDECOD + LD (IY-100+VRS.AdInPtA),C + LD (IY-100+VRS.AdInPtA+1),B + +PL1B DEC (IY-100+VRS.ChanB+CHP.NtSkCn) + JR NZ,PL1C + LD DE,VRS.ChanB+12-100 + LD C,(IY-100+VRS.AdInPtB) + LD B,(IY-100+VRS.AdInPtB+1) + CALL PTDECOD + LD (IY-100+VRS.AdInPtB),C + LD (IY-100+VRS.AdInPtB+1),B + +PL1C DEC (IY-100+VRS.ChanC+CHP.NtSkCn) + JR NZ,PL1D + LD DE,VRS.ChanC+12-100 + LD C,(IY-100+VRS.AdInPtC) + LD B,(IY-100+VRS.AdInPtC+1) + CALL PTDECOD + LD (IY-100+VRS.AdInPtC),C + LD (IY-100+VRS.AdInPtC+1),B + +PL1D LD A,(IY-100+VRS.Delay) + LD (IY-100+VRS.DelyCnt),A + +PL2 LD DE,VRS.ChanA-100 + LD L,(IY-100+VRS.AYREGS+TonA) + LD H,(IY-100+VRS.AYREGS+TonA+1) + CALL CHREGS + LD (IY-100+VRS.AYREGS+TonA),L + LD (IY-100+VRS.AYREGS+TonA+1),H +Ampl EQU $+1 + LD A,#3E + LD (IY-100+VRS.AYREGS+AmplA),A + LD DE,VRS.ChanB-100 + LD L,(IY-100+VRS.AYREGS+TonB) + LD H,(IY-100+VRS.AYREGS+TonB+1) + CALL CHREGS + LD (IY-100+VRS.AYREGS+TonB),L + LD (IY-100+VRS.AYREGS+TonB+1),H + LD A,(Ampl) + LD (IY-100+VRS.AYREGS+AmplB),A + LD DE,VRS.ChanC-100 + LD L,(IY-100+VRS.AYREGS+TonC) + LD H,(IY-100+VRS.AYREGS+TonC+1) + CALL CHREGS + LD (IY-100+VRS.AYREGS+TonC),L + LD (IY-100+VRS.AYREGS+TonC+1),H + LD A,(Ampl) + LD (IY-100+VRS.AYREGS+AmplC),A + + LD A,(IY-100+VRS.Ns_Base) + ADD (IY-100+VRS.AddToNs) + LD (IY-100+VRS.AYREGS+Noise),A + + LD A,(IY-100+VRS.AddToEn) + LD E,A + ADD A,A + SBC A,A + LD D,A + LD L,(IY-100+VRS.EnvBase) + LD H,(IY-100+VRS.EnvBase+1) + ADD HL,DE + LD E,(IY-100+VRS.CurESld) + LD D,(IY-100+VRS.CurESld+1) + ADD HL,DE + LD (IY-100+VRS.AYREGS+Env),L + LD (IY-100+VRS.AYREGS+Env+1),H + + XOR A + OR (IY-100+VRS.CurEDel) + RET Z + DEC (IY-100+VRS.CurEDel) + RET NZ + LD A,(IY-100+VRS.Env_Del) + LD (IY-100+VRS.CurEDel),A + LD L,(IY-100+VRS.ESldAdd) + LD H,(IY-100+VRS.ESldAdd+1) + ADD HL,DE + JP SETESLD + +PLAY LD IY,VARS1+100 + CALL PLAY_ + LD A,(is_ts) + AND A + JR Z,PL_nts + LD IY,VARS2+100 + CALL PLAY_ +PL_nts + IF Basic + LD IY,#5C3A + ENDIF + +ROUT LD BC,#FFFD + LD A,(is_ts) + AND A + IFDEF ONtfm + LD L,#F9 + OUT (C),L + ELSE + JR Z,r_nts ;keep old standard + OUT (C),B + ENDIF +r_nts EX AF,AF' + + IF ACBBAC + LD IX,VARS1+VRS.AYREGS + ELSE + LD HL,VARS1+VRS.AYREGS + ENDIF + + CALL ROUT_ + EX AF,AF' + RET Z + LD B,D + + IFDEF ONtfm + LD A,#F8 + ELSE + CPL + ENDIF + OUT (C),A + + IF ACBBAC + LD IX,VARS2+VRS.AYREGS + ELSE + LD HL,VARS2+VRS.AYREGS + ENDIF + +ROUT_ + IF ACBBAC + LD A,(SETUP) + AND 12 + JR Z,ABC + ADD A,CHTABLE + LD E,A + ADC A,CHTABLE/256 + SUB E + LD D,A + LD B,0 + PUSH IX + POP HL + LD A,(DE) + INC DE + LD C,A + ADD HL,BC + LD A,(IX+TonB) + LD C,(HL) + LD (IX+TonB),C + LD (HL),A + INC HL + LD A,(IX+TonB+1) + LD C,(HL) + LD (IX+TonB+1),C + LD (HL),A + LD A,(DE) + INC DE + LD C,A + ADD HL,BC + LD A,(IX+AmplB) + LD C,(HL) + LD (IX+AmplB),C + LD (HL),A + LD A,(DE) + INC DE + LD (RxCA1),A + XOR 8 + LD (RxCA2),A + LD A,(DE) + AND (IX+Mixer) + LD E,A + LD A,(IX+Mixer) +RxCA1 DB #E6 + AND %010010 + OR E + LD E,A + LD A,(IX+Mixer) + AND %010010 +RxCA2 OR E + OR E + LD (IX+Mixer),A +ABC + ENDIF + + XOR A + LD DE,#FFBF + + IF ACBBAC + LD BC,#FFFD + PUSH IX + POP HL + ENDIF + +LOUT + IFDEF ONtfm + INF + JP M,$-2 + ENDIF + OUT (C),A + IFDEF ONtfm + INF + JP M,$-2 + ENDIF + LD B,E + OUTI + LD B,D + INC A + CP 13 + JR NZ,LOUT + IFDEF ONtfm + INF + JP M,$-2 + ENDIF + OUT (C),A + LD A,(HL) + AND A + RET M + IFDEF ONtfm + INF + JP M,$-2 + ENDIF + LD B,E + OUT (C),A + RET + + IF ACBBAC +CHTABLE EQU $-4 + DB 4,5,15,%001001,0,7,7,%100100 + ENDIF + +NT_DATA DB (T_NEW_0-T1_)*2 + DB TCNEW_0-T_ + DB (T_OLD_0-T1_)*2+1 + DB TCOLD_0-T_ + DB (T_NEW_1-T1_)*2+1 + DB TCNEW_1-T_ + DB (T_OLD_1-T1_)*2+1 + DB TCOLD_1-T_ + DB (T_NEW_2-T1_)*2 + DB TCNEW_2-T_ + DB (T_OLD_2-T1_)*2 + DB TCOLD_2-T_ + DB (T_NEW_3-T1_)*2 + DB TCNEW_3-T_ + DB (T_OLD_3-T1_)*2 + DB TCOLD_3-T_ + +T_ + +TCOLD_0 DB #00+1,#04+1,#08+1,#0A+1,#0C+1,#0E+1,#12+1,#14+1 + DB #18+1,#24+1,#3C+1,0 +TCOLD_1 DB #5C+1,0 +TCOLD_2 DB #30+1,#36+1,#4C+1,#52+1,#5E+1,#70+1,#82,#8C,#9C + DB #9E,#A0,#A6,#A8,#AA,#AC,#AE,#AE,0 +TCNEW_3 DB #56+1 +TCOLD_3 DB #1E+1,#22+1,#24+1,#28+1,#2C+1,#2E+1,#32+1,#BE+1,0 +TCNEW_0 DB #1C+1,#20+1,#22+1,#26+1,#2A+1,#2C+1,#30+1,#54+1 + DB #BC+1,#BE+1,0 +TCNEW_1 EQU TCOLD_1 +TCNEW_2 DB #1A+1,#20+1,#24+1,#28+1,#2A+1,#3A+1,#4C+1,#5E+1 + DB #BA+1,#BC+1,#BE+1,0 + +PT3EMPTYORN EQU $-1 + DB 1,0 + +;first 12 values of tone tables (packed) + +T_PACK DB #06EC*2/256,#06EC*2&255 + DB #0755-#06EC + DB #07C5-#0755 + DB #083B-#07C5 + DB #08B8-#083B + DB #093D-#08B8 + DB #09CA-#093D + DB #0A5F-#09CA + DB #0AFC-#0A5F + DB #0BA4-#0AFC + DB #0C55-#0BA4 + DB #0D10-#0C55 + DB #066D*2/256,#066D*2&255 + DB #06CF-#066D + DB #0737-#06CF + DB #07A4-#0737 + DB #0819-#07A4 + DB #0894-#0819 + DB #0917-#0894 + DB #09A1-#0917 + DB #0A33-#09A1 + DB #0ACF-#0A33 + DB #0B73-#0ACF + DB #0C22-#0B73 + DB #0CDA-#0C22 + DB #0704*2/256,#0704*2&255 + DB #076E-#0704 + DB #07E0-#076E + DB #0858-#07E0 + DB #08D6-#0858 + DB #095C-#08D6 + DB #09EC-#095C + DB #0A82-#09EC + DB #0B22-#0A82 + DB #0BCC-#0B22 + DB #0C80-#0BCC + DB #0D3E-#0C80 + DB #07E0*2/256,#07E0*2&255 + DB #0858-#07E0 + DB #08E0-#0858 + DB #0960-#08E0 + DB #09F0-#0960 + DB #0A88-#09F0 + DB #0B28-#0A88 + DB #0BD8-#0B28 + DB #0C80-#0BD8 + DB #0D60-#0C80 + DB #0E10-#0D60 + DB #0EF8-#0E10 + +;vars from here can be stripped +;you can move VARS to any other address + +VARS + +is_ts DB 0 + +;ChannelsVars + STRUCT CHP +;reset group +PsInOr DB 0 +PsInSm DB 0 +CrAmSl DB 0 +CrNsSl DB 0 +CrEnSl DB 0 +TSlCnt DB 0 +CrTnSl DW 0 +TnAcc DW 0 +COnOff DB 0 +;reset group + +OnOffD DB 0 + +;IX for PTDECOD here (+12) +OffOnD DB 0 +OrnPtr DW 0 +SamPtr DW 0 +NNtSkp DB 0 +Note DB 0 +SlToNt DB 0 +Env_En DB 0 +Flags DB 0 + ;Enabled - 0, SimpleGliss - 2 +TnSlDl DB 0 +TSlStp DW 0 +TnDelt DW 0 +NtSkCn DB 0 +Volume DB 0 + ENDS + + STRUCT VRS + +;IF not works in STRUCT in SjASM :( +; IF CurPosCounter +CurPos DB 0 +PosSub DB 0 +; ENDIF + +ModNum DB 0 ;bit0: ChipNum + ;bit1: 1-reversed patterns order (AlCo TS) + +ChanA DS CHP +ChanB DS CHP +ChanC DS CHP + +;GlobalVars +MODADDR DW 0 +OrnPtrs DW 0 +SamPtrs DW 0 +PatsPtr DW 0 +AdInPtA DW 0 +AdInPtB DW 0 +AdInPtC DW 0 +CrPsPtr DW 0 +LPosPtr DW 0 +Delay DB 0 +DelyCnt DB 0 +ESldAdd DW 0 +CurESld DW 0 +Env_Del DB 0 +CurEDel DB 0 +Ns_Base DB 0 +AddToNs DB 0 +AddToEn DB 0 +EnvBase DW 0 +AYREGS DS 14 + ENDS + +VARS1 DS VRS +VARS2 DS VRS + +VT_ EQU $-16 + DS 256-16 ;CreatedVolumeTableAddress + +T1_ EQU VT_+16 ;Tone tables data depacked here + +T_OLD_1 EQU T1_ +T_OLD_2 EQU T_OLD_1+24 +T_OLD_3 EQU T_OLD_2+24 +T_OLD_0 EQU T_OLD_3+2 +T_NEW_0 EQU T_OLD_0 +T_NEW_1 EQU T_OLD_1 +T_NEW_2 EQU T_NEW_0+24 +T_NEW_3 EQU T_OLD_3 + +PT2EMPTYORN EQU VT_+31 ;1,0,0 sequence + +NT_ DS 192 ;CreatedNoteTableAddress + +VAR0END EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 + +VARSEND EQU $ +MDLADDR EQU $ + + DISPLAY "PTS player size=",$-START + +;Release 0 steps: +;04/21/2007 +;Works start (PTxPlay adaptation); first beta. +;04/22/2007 +;Job finished; beta-testing. +;04/23/2007 +;PT v3.7 TS mode corrected (after AlCo remarks). +;04/29/2007 +;Added 1.XX and 2.XX special commands interpretation for PT3 +;modules of v3.7+. + +;Size (minimal build for ZX Spectrum): +;Code block #908 bytes +;Variables #2BF bytes (can be stripped) +;Total size #908+#2BF=#BC7 (3015) bytes + + ENDMOD + + endif diff --git a/_pt/format.asm b/_pt/format.asm new file mode 100644 index 0000000..bb0af2f --- /dev/null +++ b/_pt/format.asm @@ -0,0 +1,45 @@ +;some format checking macros + ifndef _format_asm_defined + define _format_asm_defined + + macro LessOrEqual number + ld a,number + cp (hl) + inc hl + ret c + endm + + macro Greater number + ld a,(hl) + inc hl + cp number + ret c + endm + + macro AnyByte + inc hl + endm + + macro AnyBytes count + if count > 7 + ld a,l + add a,count + ld l,a + adc a,h + sub l + ld h,a + else + dup count + inc hl + edup + endif + endm + + macro EqualTo number + ld a,number + cp (hl) + inc hl + ret nz + endm + + endif diff --git a/_pt/mtc.asm b/_pt/mtc.asm new file mode 100644 index 0000000..a2dcddc --- /dev/null +++ b/_pt/mtc.asm @@ -0,0 +1,425 @@ + ifndef _mtc_asm_defined + define _mtc_asm_defined + + module MTC + + ;enum-like + struct StreamType +PT3 db 0 +PT2 db 0 +TS db 0 +TFC db 0 +Unknown db 0 + ends + + struct StreamData +Type db 0 +Data1 dw 0 +Data2 dw 0 +Init dw 0 +Play dw 0 +Mute dw 0 + ends + +Start + ifndef NoPrologue + ld hl,End + jr Init + jp Play + jp Mute + endif + + ifdef HaveFormatCheck + + include "format.asm" + +;in HL - module addr +;out Z - is mtc +CheckFormat + EqualTo "M" + EqualTo "T" + EqualTo "C" + EqualTo "1" + EqualTo 0 + EqualTo 0 + ret + + display "MTC checker size: ",$-CheckFormat + + endif + +;in HL - module addr +Init ld ix,Streams + ld (ix+StreamData.Type),StreamType.Unknown + call ParseChunk + cp ChunkId.MTC1 + call z,ParseMTC1 + call MergeStreams + ld ix,Streams +.initstreams + ld a,(ix+StreamData.Type) + cp StreamType.Unknown + ret z + ld l,(ix+StreamData.Data1) + ld h,(ix+StreamData.Data1+1) + ld e,(ix+StreamData.Data2) + ld d,(ix+StreamData.Data2+1) + ld c,(ix+StreamData.Init) + ld b,(ix+StreamData.Init+1) + push ix + call jp_bc + pop ix + ld bc,StreamData + add ix,bc + jr .initstreams + +Play ld ix,Streams +.playstreams + ld a,(ix+StreamData.Type) + cp StreamType.Unknown + ret z + ld c,(ix+StreamData.Play) + ld b,(ix+StreamData.Play+1) + push ix + call jp_bc + pop ix + ld bc,StreamData + add ix,bc + jr .playstreams + +Mute ld ix,Streams +.mutestreams + ld a,(ix+StreamData.Type) + cp StreamType.Unknown + ret z + ld c,(ix+StreamData.Mute) + ld b,(ix+StreamData.Mute+1) + push ix + call jp_bc + pop ix + ld bc,StreamData + add ix,bc + jr .mutestreams + +jp_bc push bc + ret + +;in hl - chunk start +;out a - chunkid +;out hl - chunk data start +;out bc - chunk data size +;corrupt de +ParseChunk + ld de,ChunkId +.checkid + ld b,4 + dup 4 + ld a,(de) + inc e + cp (hl) + inc hl + jr nz,$+3 + dec b + edup + ;nz if last byte is not matched + ;nz if b != 0 (not all bytes matched) + ld a,e + jr z,.matched + cp ChunkId.Unknown + jr z,.getdata + dec hl,hl,hl,hl + jr .checkid +.matched + sub 4 +.getdata + ;skip higher bytes of size, assume they are zero + inc hl + inc hl + ld b,(hl) + inc hl + ld c,(hl) + inc hl + ret + +;put streams in gap +Streams +MinStreamsCount=3 ;approx: ts+tfm + ds MinStreamsCount*StreamData ;approx +Streams.End + display "MTC: loosed ",256-low $," bytes" + align 256 + +ChunkId +.MTC1=low $ + db "MTC1" +.TRCK=low $ + db "TRCK" +.DATA=low $ + db "DATA" +.NAME=low $ + db "NAME" +.AUTH=low $ + db "AUTH" +.ANNO=low $ + db "ANNO" +.PROP=low $ + db "PROP" +.Unknown=low $ + +MaxStreamsCount=(ChunkId-Streams)/StreamData + display "MTC: max streams ",MaxStreamsCount + + macro MoveNextChunk + ;chunk is always aligned at word boundary, so correct odd length + push bc + pop af + adc hl,bc + endm + +;in hl - content +;in bc - size +ParseMTC1 + push hl + add hl,bc + ex (sp),hl + ; (sp) - end of avail data +.nextchunk + call ParseChunk + push hl,bc + cp ChunkId.TRCK + call z,ParseTrack + pop bc,hl + MoveNextChunk + pop bc + ;hl- end of chunk + ;de- end of avail + sbc hl,bc + ret z ;last chunk + add hl,bc + push bc + jr .nextchunk + +;in hl - content +;in bc - size +ParseTrack + push hl + add hl,bc + ex (sp),hl + ; (sp) - end of avail data +.nextchunk + call ParseChunk + push hl,bc + cp ChunkId.DATA + call z,ParseData + exa + pop bc,hl + MoveNextChunk + pop bc + exa + ret z ;data is parsed + ;hl- end of chunk + ;de- end of avail + and a + sbc hl,bc + ret z ;last chunk + add hl,bc + push bc + jr .nextchunk + +;in hl - content +;in bc - size +;out Z - data parsed and added as stream +ParseData + call ParseTFC + call nz,ParseTS + call nz,ParsePT2 + jr nz,ParsePT3 + ret + +ParseTFC + push hl,bc + call TFC.CheckFormat + pop bc,hl + ret nz + ld a,StreamType.TFC + exx + ld hl,TFC.Init + ld de,TFC.Play + ld bc,TFC.Mute + call FillStream +AddStream + ld bc,StreamData + add ix,bc + ld (ix+StreamData.Type),StreamType.Unknown + xor a;set Z + ret + +ParseTS + push hl,bc + call TS.CheckFormatKnownSize + pop bc,hl + ret nz + call FillTS + jr AddStream + +ParsePT2 + push hl,bc + call PT2.CheckFormat + pop bc,hl + ret nz + ld a,StreamType.PT2 + exx + ld hl,PT2.Init + call FillPts + jr AddStream + +ParsePT3 + push hl,bc + call PT3.CheckFormat + pop bc,hl + ret nz + ld a,StreamType.PT3 + exx + ld hl,PT3.Init + call FillPts + jr AddStream + +FillTS ld a,StreamType.TS + exx + ld hl,TS.Init +FillPts ld de,PTS.PLAY + ld bc,PTS.MUTE +FillStream + ld (ix+StreamData.Type),a + ld (ix+StreamData.Init),l + ld (ix+StreamData.Init+1),h + ld (ix+StreamData.Play),e + ld (ix+StreamData.Play+1),d + ld (ix+StreamData.Mute),c + ld (ix+StreamData.Mute+1),b + exx + ld (ix+StreamData.Data1),l + ld (ix+StreamData.Data1+1),h + ld (ix+StreamData.Data2),e + ld (ix+StreamData.Data2+1),d + ret + +;some business-logic related to supported players +MergeStreams + ld a,(Streams+StreamData.Type) + cp StreamType.Unknown + ret z ;no streams + ld a,(Streams+StreamData+StreamData.Type) + cp StreamType.Unknown + ret z ;single stream + + ;sort streams according to type, use simple bubblesort +Sort + assert 0 == ((Streams ^ Streams.End) >> 8) + assert 0 == StreamData.Type + ld de,Streams + ld hl,Streams+StreamData + ld c,0;swaps mark +.cycle + ld a,(de) + cp StreamType.Unknown + jr z,.end + cp (hl) + jr c,.next + jr z,.next + ld b,StreamData +.swapitems + ld a,(de) + ld c,(hl) + ld (hl),a + ld a,c + ld (de),a + inc l + inc e + djnz .swapitems + ld c,h + jr .cycle +.next + ld e,l + ld a,l + add a,StreamData + ld l,a + jr .cycle +.end + ld a,c + and a + jr nz,Sort + ;try merge streams + ; X X merged to X (last is taken) + ; PT3 PT3 merged to TS +Merge + assert 0 == StreamData.Type + ld de,Streams + ld hl,Streams+StreamData +.cycle + ld a,(de) + cp StreamType.Unknown + ret z + cp (hl) + jr z,.perform + ld e,l + ld a,l + add a,StreamData + ld l,a + jr .cycle +.perform + cp StreamType.PT3 + jr nz,.generic + ;merge PT3 streams to TS + push hl,de + push hl,de + inc l + ld e,(hl) + inc l + ld d,(hl) ;data1 + pop hl + inc l + ld a,(hl) + inc l + ld h,(hl) + ld l,a ;data2 + pop ix + call FillTS + pop de,hl +.generic + ;for other types just take last one + ld b,StreamData +.copyitems + ld a,(hl) + ld (de),a + inc l + inc e + djnz .copyitems + ld a,(de) + cp StreamType.Unknown + jr nz,.generic + jr MergeStreams + + endmod + + ifndef NoPrologue + define NoPrologue + endif + + ifndef HaveFormatCheck + define HaveFormatCheck + endif + + ifndef ONtfm + ; define ONtfm + endif + + include "PTSPlay.asm" + include "pt3.asm" + include "pt2.asm" + include "ts.asm" + include "tfc.asm" +MTC.End + display "MTC module size: ",MTC.End-MTC.Start + + endif diff --git a/_pt/pt2.asm b/_pt/pt2.asm new file mode 100644 index 0000000..194e54e --- /dev/null +++ b/_pt/pt2.asm @@ -0,0 +1,84 @@ + ifndef _pt2_asm_defined + define _pt2_asm_defined + + module PT2 + + struct Header +Tempo db 0 ;02-ff +Length db 0 ;01-ff +Loop db 0 ;00-fe +Samples + ds 64 ;(? 00-36){32} +Ornaments + ds 32 ;(? 00-36){16} +Patterns + dw 0 ;? 00-01 +Name ds 30 ;? +Positions + db 0 ;00-1f + db 0 ;ff|00-1f + ends + +Start + ifndef NoPrologue + ld hl,End + jr Init + jp PTS.PLAY + jp PTS.MUTE + endif + +Init ld a,PTS.SETUP.PT2 + jp PTS.INIT + + ifdef HaveFormatCheck + include "format.asm" + +;in HL - module addr +;out Z - is pt2 +CheckFormat + ;Tempo + Greater 2 + ;Length + Greater 1 + ;Loop + LessOrEqual 254 + ;Samples+Ornaments + ld b,(Header.Patterns-Header.Samples)/2 +.samorns + AnyByte + LessOrEqual #36 + djnz .samorns + ;Patterns + AnyByte + LessOrEqual 1 + ;Name + AnyBytes Header.Positions-Header.Name + ;Positions + ;first should be not marker + LessOrEqual #1f + ld b,255 ;max positions +.positions + ld a,(hl) + cp 255 + ret z ;finish + LessOrEqual #1f + djnz .positions + ;fall through +.fail ld a,h + and a ;reset Z + ret + + display "PT2 checker size: ",$-CheckFormat + endif + + endmod + + include "PTSPlay.asm" + +PT2.Play=PTS.PLAY +PT2.Mute=PTS.MUTE +PT2.End + + display "PT2 module size: ",PT2.End-PT2.Start + endif + \ No newline at end of file diff --git a/_pt/pt3.asm b/_pt/pt3.asm new file mode 100644 index 0000000..2575cef --- /dev/null +++ b/_pt/pt3.asm @@ -0,0 +1,106 @@ + ifndef _pt3_asm_defined + define _pt3_asm_defined + + module PT3 + + struct Header +Id ds 13 ; usually 'Protracker 3.' +Subversion + db 0 +Description + ds 84 ; usually ' compilation of ' + Name[32] + ' by ' + Author[32] +Mode db 0 +FreqTable + db 0 ;assume 0..04 +Tempo db 0 ;01-ff +Length db 0 +Loop db 0 +Patterns + dw 0 ;? 00-01 +Samples + ds 64 ;(? 00-bf}{32} +Ornaments + ds 32 ;(? 00-d9){16} +Positions + db 0 ;*3&00-fe + db 0 ;*3|ff + ends + +Start + ifndef NoPrologue + ld hl,End + jr Init + jp PTS.PLAY + jp PTS.MUTE + endif + +Init ld a,PTS.SETUP.TSPT3 + jp PTS.INIT + + ifdef HaveFormatCheck + include "format.asm" + +;in HL - module addr +;out Z - is pt3 +CheckFormat + ; meta + AnyBytes Header.FreqTable + ;FreqTable + LessOrEqual 4 + ;Tempo + Greater 1 + ;Length + AnyByte + ;Loop + AnyByte + ;Patterns + AnyByte + LessOrEqual 1 + ;Samples + ld b,(Header.Ornaments-Header.Samples)/2 +.samples + AnyByte + LessOrEqual #bf + djnz .samples + ;Ornaments + ld b,(Header.Positions-Header.Ornaments)/2 +.ornaments + AnyByte + LessOrEqual #d9 + djnz .ornaments + ;Positions + ;255 at first position is denied + LessOrEqual 254 + ld b,0 + dec hl +.positions + ld a,(hl) + inc hl + cp 255 + ret z ;finish + ;check is multiple of 3 +.div3 and a + jr z,.posok + sub 3 + ret c + jr nz,.div3 +.posok djnz .positions + ;fall through +.fail ld a,h + and a ;reset Z + ret + + display "PT3 checker size: ",$-CheckFormat + endif + + endmod + + include "PTSPlay.asm" +PT3.Play=PTS.PLAY +PT3.Mute=PTS.MUTE +PT3.End + + display "PT3 module size: ",PT3.End-PT3.Start + + endif + \ No newline at end of file diff --git a/_pt/ptx.asm b/_pt/ptx.asm new file mode 100644 index 0000000..ef28857 --- /dev/null +++ b/_pt/ptx.asm @@ -0,0 +1,61 @@ + ifndef _ptx_asm_defined + define _ptx_asm_defined + + module PTX + ld hl,End + jr Init +Play jp 0 +Mute jp 0 + +Init + call .tryTS + call nz,.tryPT2 + call nz,.tryPT3 + ret z + ld hl,.ex + ld d,h,e,l +.addr ld (Play+1),hl + ld (Mute+1),de +.ex ret + +.tryTS + push hl + call TS.CheckFormat + pop hl + ret nz + call TS.Init + ld hl,TS.Play + ld de,TS.Mute + jr .addr + +.tryPT2 + push hl + call PT2.CheckFormat + pop hl + ret nz + call PT2.Init + ld hl,PT2.Play + ld de,PT2.Mute + jr .addr + +.tryPT3 + push hl + call PT3.CheckFormat + pop hl + ret nz + call PT3.Init + ld hl,PT3.Play + ld de,PT3.Mute + jr .addr + + endmod + + define HaveFormatCheck + define NoPrologue + include "_pt/PTSPlay.asm" + include "_pt/pt3.asm" + include "_pt/pt2.asm" + include "_pt/ts.asm" +PTX.End + display "PTX module size: ",PTX.End-PTX.Init + endif \ No newline at end of file diff --git a/_pt/tfc.asm b/_pt/tfc.asm new file mode 100644 index 0000000..620f820 --- /dev/null +++ b/_pt/tfc.asm @@ -0,0 +1 @@ + ifndef _tfc_asm_defined define _tfc_asm_defined module TFC ; Original version by (C) Alone Coder ; SjasmPlus adaptation, code cleanup and size optimization by (C) Vitamin/CAIG ; Warning: no 60Hz modules support! ;TODO begin&end ⮫쪮 ¢ ®¤­®¬ ª ­ «¥ newtfm=1 ;0=revision A, 1=revision C if newtfm == 1 statuschip0=%11111000 statuschip1=%11111001 else if newtfm == 2 ;US031DX statuschip0=%11111110 statuschip1=%11111111 else ;newtfm=0 statuschip0=%11111100 statuschip1=%11111101 endif endif struct Header signature ds 6 version ds 3 intfreq db 0 tfmptrs ds 12 ssgptrs ds 12 ends struct TFMData addr dw 0 skip db 0 blkcnt db 0 blkretaddr db 0 loopaddr db 0 tfmlow db 0 tfmhigh db 0 ends macro WaitStatus if newtfm != 2 inf jp m,$-2 endif endm macro FM.OutReg Reg WaitStatus out (c),Reg endm macro FM.SelectReg Reg ld b,d FM.OutReg Reg endm macro FM.WriteReg Reg ld b,e FM.OutReg Reg endm Start ld hl,End jr Init jp Play jp Mute ifdef HaveFormatCheck include "format.asm" ;in HL - module addr ;out Z - is tfc ;out C - 60 Hz (valid only if Z) CheckFormat EqualTo "T" EqualTo "F" EqualTo "M" EqualTo "c" EqualTo "o" EqualTo "m" AnyBytes 3 ld a,(hl) cp 50 ret z cp 60 ccf ret display "TFC checker size: ",$-CheckFormat endif ;HL - module addr Init exd ld hl,Header.tfmptrs add hl,de exx ld hl,TFM.Init ld de,TFM.A ld bc,6*TFMData ldir ld hl,.tfminitab ld bc,128*(.tfminitab_end-.tfminitab)+#fd .tfmini0 ld de,.tfminiHL ldi ldi exx ld a,(hl) inc hl push hl ld h,(hl) ld l,a add hl,de .tfminiHL=$+1 ld (0),hl pop hl inc hl exx djnz .tfmini0 jp Mute .tfminitab DW TFM.A.addr DW TFM.B.addr DW TFM.C.addr DW TFM.D.addr DW TFM.E.addr DW TFM.F.addr .tfminitab_end Mute ld de,#ffbf ld c,#fd call selChip0 call .tfminiPP call selChip1 .tfminiPP ; 0 -> (00..0D) ld hl,#0000 ld a,#0e call .writeregsset ; 0 -> (30..3F) ld h,#30 ld a,#40 call .writeregsset ; 0 -> (50..B4) ld h,#50 ld a,#b5 call .writeregsset ; 0F -> (80..8F) ;max speed to RR ld hl,#800f ld a,#90 call .writeregsset ; 0..2 -> 28, key off ; 2 -> 27 channel 3 mode ld hl,#2800 call .writereg inc l call .writereg inc l call .writereg dec h call .writereg ; 7F -> (40..4F,2F,2D) ld hl,#407f ld a,#50 call .writeregsset ld h,#2f call .writereg ld h,#2d call .writereg ld a,#ff ;¢몫. FM .selRegA ld b,d out (c),a ret ;H=REG start ;L=VALUE ;A=REG end (not inclusive) .writeregsset call .writereg inc h cp h jr nz,.writeregsset ret ;H=REG ;L=VALUE .writereg FM.SelectReg h FM.WriteReg l ret selChip0 ld a,statuschip0 jr Mute.selRegA selChip1 ld a,statuschip1 jr Mute.selRegA Play ld de,#FFBF ld c,#FD call selChip0 xor a exa ld ix,TFM.A call PlayChannel ld a,1 exa ld ix,TFM.B call PlayChannel ld a,2 exa ld ix,TFM.C call PlayChannel call selChip1 xor a exa ld ix,TFM.D call PlayChannel ld a,1 exa ld ix,TFM.E call PlayChannel ld a,2 exa ld ix,TFM.F jp PlayChannel ;%11111111,-disp8 = ¤ ­­ë¥ ª ¤à  «¥¦ â ¯® ᬥ饭¨î -disp8 ;%111ttttt = skip 32..2 frames ;%110ddddd = slide d-16 ;%11010000,frames,-disp16 = repeat block (skips = 1 frame) ;%10111111,-disp16 = ¤ ­­ë¥ ª ¤à  «¥¦ â ¯® ᬥ饭¨î -disp16 ;%10NNNNNf = keyoff,[freq,]0..30 regs, keyon ;%01111111 = end ;%01111110 = begin ;%01NNNNNf = keyoff,[freq,]0..31 regs ;%00NNNNNf = [freq,]0..30 regs bb=%01111110 be=%01111111 ;IX - data ;DE - hi ports #FFBF ;C - low port #FD ;A' - fm channel PlayChannel ld a,(ix+TFMData.skip) inc a jp nz,.skiper ld a,(ix+TFMData.blkcnt) and a jr z,.noframe dec (ix+TFMData.blkcnt) jr nz,.noframe ld l,(ix+TFMData.blkretaddr) ld h,(ix+TFMData.blkretaddr+1) jr .tfmframe .begin ld (ix+TFMData.loopaddr),l ld (ix+TFMData.loopaddr+1),h jr .tfmframe .end ld l,(ix+TFMData.loopaddr) ld h,(ix+TFMData.loopaddr+1) jr .tfmframe .noframe ld l,(ix+TFMData.addr) ld h,(ix+TFMData.addr+1) .tfmframe ld a,(hl) inc hl cp bb jr z,.begin cp be jr z,.end cp e ;#BF jp NC,.HLskiper ;TestKeyOff jp P,.noffX push af ld a,#28 FM.SelectReg a exa FM.WriteReg a ;FMChannel exa pop af .noffX OR a push af ;TestFreq RRA jr NC,.nofrqX ld b,(hl) inc hl ld c,(hl) inc hl ld (ix+TFMData.tfmhigh),b ld (ix+TFMData.tfmlow),c push bc ex (sp),hl ld c,#FD call .outTone pop hl .nofrqX and #1F call nz,.OutRegs call .storeaddr pop af ret P ;.KeyOn ld a,#28 FM.SelectReg a exa add a,#F0 FM.WriteReg a sub #F0 exa ret .block ld a,(hl) ;N frames ;1 now, N-1 later ;skip command is used as 1 frame inc hl ld (ix+TFMData.blkcnt),a ld b,(hl) inc hl ld c,(hl) ;disp inc hl ld (ix+TFMData.blkretaddr),l ld (ix+TFMData.blkretaddr+1),h .subframe add hl,bc ld c,#fd jp .tfmframe .OLDfar ld b,(hl) inc hl .OLDnear ld c,(hl) inc hl push hl call .subframe pop hl .storeaddr ld (ix+TFMData.addr),l ld (ix+TFMData.addr+1),h ret .HLskiper jr z,.OLDfar cp %11100000 jr c,.slide ld b,a cp d ;#FF jr z,.OLDnear call .storeaddr .skiper ld (ix+TFMData.skip),a ret .slide ;a=-64..-33 add a,48 ;a=-16..15 jr z,.block add a,(ix+TFMData.tfmlow) ld (ix+TFMData.tfmlow),a call .storeaddr ld h,(ix+TFMData.tfmhigh) ld l,a .outTone exa add a,#a4 FM.SelectReg a FM.WriteReg h sub #04 ;#A0+channel FM.SelectReg a FM.WriteReg l sub #a0 exa ret .OutRegs ld b,d ;%11111xxx WaitStatus outi ;reg WaitStatus ld b,e ;#BF outi ;value dec a jr nz,.OutRegs ;¢ turbo jr=jp ret TFM.Init TFMData 0,-1,0 TFM.A TFMData TFM.B TFMData TFM.C TFMData TFM.D TFMData TFM.E TFMData TFM.F TFMData endmod TFC.End display "TFC module size: ",TFC.End-TFC.Start endif \ No newline at end of file diff --git a/_pt/ts.asm b/_pt/ts.asm new file mode 100644 index 0000000..df09d8f --- /dev/null +++ b/_pt/ts.asm @@ -0,0 +1,102 @@ + ifndef _ts_asm_defined + define _ts_asm_defined + + module TS + + struct Footer +Sign1 DS 4 +Size1 DW 0 +Sign2 DS 4 +Size2 DW 0 +Sign3 DS 4 + ENDS + +Start + ifndef NoPrologue + ld hl,End + jr .init + jp PTS.PLAY + jp PTS.MUTE +.init call CheckFormat + ;ignore invalids + endif + +Init ld a,PTS.SETUP.TS02 + jp PTS.INIT + +;in HL - module addr +;out Z - is ts +;out HL/DE modules offsets (valid only if Z) +CheckFormat + ld d,h,e,l + inc d ;skip 256 bytes +.findfooter + ld h,d,l,e + call CheckFooter + ret z + inc e + jr nz,.findfooter + inc d + jr nz,.findfooter + inc e ;reset Z + ;hl/de are invalid!!! + ret + +;in HL - module addr +;in BC - module size +;out Z - is ts +;out HL/DE - modules offsets (valid only if Z) + ifdef HaveFormatCheck +CheckFormatKnownSize + add hl,bc + endif +CheckFooter + dec hl + ld a,(hl) + cp "S" + ret nz + dec hl + ld a,(hl) + cp "T" + ret nz + dec hl + ld a,(hl) + cp "2" + ret nz + dec hl + ld a,(hl) + cp "0" + ret nz + dec hl + ld d,(hl) + dec hl + ld e,(hl) ;Size2 + dec hl,hl,hl,hl;skip Sign2 + dec hl + ld b,(hl) + dec hl + ld c,(hl) ;Size1 + dec hl,hl,hl,hl;skip Sign1 + + sbc hl,de + ld d,h + ld e,l + sbc hl,bc + xor a + ret + + ifdef HaveFormatCheck + display "TS checker size: ",$-CheckFormat + endif + + endmod + + include "PTSPlay.asm" + +TS.End +TS.Play=PTS.PLAY +TS.Mute=PTS.MUTE + + display "TS module size: ",TS.End-TS.Start + + endif diff --git a/_pt/uni.asm b/_pt/uni.asm new file mode 100644 index 0000000..c39b061 --- /dev/null +++ b/_pt/uni.asm @@ -0,0 +1,80 @@ + ifndef _uni_asm_defined + define _uni_asm_defined + + module UNI + ld hl,End + jr Init +Play jp 0 +Mute jp 0 + +Init ;check most stable first + call .tryMTC + call nz,.tryTFC + call nz,.tryTS + call nz,.tryPT2 + call nz,.tryPT3 + ret z + ld hl,.ex + ld d,h,e,l +.addr ld (Play+1),hl + ld (Mute+1),de +.ex ret + +.tryMTC + push hl + call MTC.CheckFormat + pop hl + ret nz + call MTC.Init + ld hl,MTC.Play + ld de,MTC.Mute + jr .addr + +.tryTFC + push hl + call TFC.CheckFormat + pop hl + ret nz + call TFC.Init + ld hl,TFC.Play + ld de,TFC.Mute + jr .addr + +.tryTS + push hl + call TS.CheckFormat + pop hl + ret nz + call TS.Init + ld hl,TS.Play + ld de,TS.Mute + jr .addr + +.tryPT2 + push hl + call PT2.CheckFormat + pop hl + ret nz + call PT2.Init + ld hl,PT2.Play + ld de,PT2.Mute + jr .addr + +.tryPT3 + push hl + call PT3.CheckFormat + pop hl + ret nz + call PT3.Init + ld hl,PT3.Play + ld de,PT3.Mute + jr .addr + + endmod + + define HaveFormatCheck + define NoPrologue + include "_pt/mtc.asm" +UNI.End + display "UNI module size: ",UNI.End-UNI.Init + endif \ No newline at end of file diff --git a/_rs232/i-vspd6a.zip b/_rs232/i-vspd6a.zip new file mode 100644 index 0000000..5f3a68b Binary files /dev/null and b/_rs232/i-vspd6a.zip differ diff --git a/_rs232/ic.bat b/_rs232/ic.bat new file mode 100644 index 0000000..9138896 --- /dev/null +++ b/_rs232/ic.bat @@ -0,0 +1 @@ +ic.exe com5 \ No newline at end of file diff --git a/_rs232/ic.exe b/_rs232/ic.exe new file mode 100644 index 0000000..5dfe1c5 Binary files /dev/null and b/_rs232/ic.exe differ diff --git a/_rs232/ic_115200.exe b/_rs232/ic_115200.exe new file mode 100644 index 0000000..4a15073 Binary files /dev/null and b/_rs232/ic_115200.exe differ diff --git a/_rs232/ic_230400.exe b/_rs232/ic_230400.exe new file mode 100644 index 0000000..b6410fd Binary files /dev/null and b/_rs232/ic_230400.exe differ diff --git a/_rs232/ic_emul/ic.bat b/_rs232/ic_emul/ic.bat new file mode 100644 index 0000000..5d69f94 --- /dev/null +++ b/_rs232/ic_emul/ic.bat @@ -0,0 +1 @@ +ic_115200.exe COM5 \ No newline at end of file diff --git a/_rs232/ic_emul/ic.exe b/_rs232/ic_emul/ic.exe new file mode 100644 index 0000000..29de4be Binary files /dev/null and b/_rs232/ic_emul/ic.exe differ diff --git a/_rs232/ic_emul/ic_115200.exe b/_rs232/ic_emul/ic_115200.exe new file mode 100644 index 0000000..4a15073 Binary files /dev/null and b/_rs232/ic_emul/ic_115200.exe differ diff --git a/_rs232/ic_emul/ic_230400.exe b/_rs232/ic_emul/ic_230400.exe new file mode 100644 index 0000000..b6410fd Binary files /dev/null and b/_rs232/ic_emul/ic_230400.exe differ diff --git a/_rs232/ic_emul/ic_cmds.c b/_rs232/ic_emul/ic_cmds.c new file mode 100644 index 0000000..96c33eb --- /dev/null +++ b/_rs232/ic_emul/ic_cmds.c @@ -0,0 +1,546 @@ +#include + +#include "ic_comm.h" +#include "ic_cmds.h" +#include "uart.h" +#include "log.h" + +//Winsock shit +WORD wVersionRequested; +WSADATA wsaData; + + +//vars +SOCKET sockets[SOCKET_MAX]; + + + +//Init +int init(char *comport) +{ + int i; + + for(i=0; i=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_BIND: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + loc_addr.sin_family = AF_INET; //fix in proto? + loc_addr.sin_addr.S_un.S_addr=htonl(params[1] | (params[2]<<8) | (params[3]<<16) | (params[4]<<24)); + loc_addr.sin_port=htons(params[5] | (params[6]<<8)); + if(bind(sockets[fd], (struct sockaddr *)&loc_addr, sizeof(loc_addr)) == 0) + { //bind ok + cmd_res_ok(); + log_("Socket id=%i binded to %u.%u.%u.%u:%u.",fd,params[1],params[2],params[3],params[4], params[5] | (params[6]<<8)); + } + else + { //bind error + cmd_res_fail(); + logerr("bind() error."); + } + } +} + + +void cmd_connect(void) +{ + unsigned char params[10]; + unsigned char fd; + struct sockaddr_in rm_addr; + + //get params + uart_read(params,7); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_CONNECT: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + rm_addr.sin_family = AF_INET; //fix in proto? + rm_addr.sin_addr.S_un.S_addr=htonl(params[4] | (params[3]<<8) | (params[2]<<16) | (params[1]<<24)); + rm_addr.sin_port=htons(params[5] | (params[6]<<8)); + if(connect(sockets[fd], (struct sockaddr *)&rm_addr, sizeof(rm_addr)) == 0) + { //connect ok + cmd_res_ok(); + log_("Socket id=%i connected to %u.%u.%u.%u:%u.",fd,params[1],params[2],params[3],params[4], params[5] | (params[6]<<8)); + } + else + { //connect error + cmd_res_fail(); + logerr("connect() error."); + } + } +} + + + +void cmd_listen(void) +{ + +} + + + +void cmd_accept(void) +{ + +} + + + +void cmd_close(void) +{ + unsigned char fd; + + //get params + uart_read(&fd,1); + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_CLOSE: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + closesocket(sockets[fd]); + sockets[fd]=0; + cmd_res_ok(); + log_("Close socket, id=%i.",fd); + } +} + + + +void cmd_select(void) +{ + unsigned char params[MAX_SELECT],tlen[3]; + fd_set fdrd; + fd_set fdwr; + fd_set fdexc; + struct timeval tout={0,0}; + int n,nr,nw,ne,i,p; + + //get nums & timeout + uart_read(params,3); + nr=params[0]; + nw=params[1]; + ne=params[2]; + n=nr+ne+nw; + + if(n>MAX_SELECT || nr>MAX_SELECT || nw>MAX_SELECT || ne>MAX_SELECT) + { //too much sockets! error... + while(n>0) + { + nr=(n>MAX_SELECT) ? MAX_SELECT : n; + uart_read(params,nr); + n-=nr; + } + cmd_res_fail(); + logerr("CMD_SELECT: Too much sockets."); + return; + } + else + { //ok, get fds + uart_read(params,n); + FD_ZERO(&fdrd); + FD_ZERO(&fdwr); + FD_ZERO(&fdexc); + + //fill fd_set + if(nr) + { + for(i=0;ih_addr_list[0],4); + uart_write(params,4); + log_("CMD_GETHOSTBYNAME: %s resolved to %d.%d.%d.%d.",buf, + params[0],params[1],params[2],params[3]); + } + free(buf); + } + else + { + cmd_res_fail(); + logerr("CMD_GETHOSTBYNAME: malloc() failed."); + } +} + + + +void cmd_gethostbyaddr(void) +{ + +} + + + + + +void cmd_send(void) +{ + unsigned char params[10]; + unsigned char fd; + unsigned char *buf; + unsigned short len,sent; + + //get params + uart_read(params,4); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_SEND: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + len=params[1] + 256*params[2]; + buf=(unsigned char*)malloc(len); + + if(buf) + { //mem ok + cmd_res_ok(); + //get data and send it to real socket + uart_read(buf,len); + sent=send(sockets[fd],buf,len,0); + //report real sent/error + params[0]=sent & 0xff; params[1]=(sent>>8) & 0xff; + uart_write(params,2); + + free(buf); + log_("Socket id=%i send %u bytes.",fd,len); + } + else + { //no mem + cmd_res_fail(); + logerr("CMD_SEND: no memory."); + } + } + +} + + + +void cmd_recv(void) +{ + unsigned char params[10]; + unsigned char fd; + unsigned char *buf; + unsigned short len,reallen; + fd_set fdset; + struct timeval tout={0,0}; + int n; + + //get params + uart_read(params,4); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_RECV: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + len=params[1] + 256*params[2]; + buf=(unsigned char*)malloc(len+3); + + if(buf) + { //mem ok + FD_ZERO(&fdset); FD_SET(sockets[fd], &fdset); + n=select(FD_SETSIZE, &fdset, NULL, NULL, &tout); + + if(n==0) + { //timeout, no data, socket ok + buf[0]=IC_CMD_RES_OK; + buf[1]=0; + buf[2]=0; + uart_write(buf,3); + log_("Socket id=%i recv 0 bytes.",fd); + } + else if(n==SOCKET_ERROR) + { //socket error + cmd_res_fail(); + logerr("CMD_RECV: socket error (closed?), id=%i.",fd); + } + else + { //data present, read + reallen=recv(sockets[fd],buf+3,len,0); + if(reallen==0) + { //socket closed + cmd_res_fail(); + log_("CMD_RECV: socket closed, id=%i.",fd); + } + else + { + //report real sent/error + buf[0]=IC_CMD_RES_OK; + buf[1]=reallen & 0xff; buf[2]=(reallen>>8) & 0xff; + uart_write(buf,reallen+3); + log_("Socket id=%i recv %u bytes.",fd,reallen); + } + } + free(buf); + } + else + { //no mem + cmd_res_fail(); + logerr("CMD_RECV: no memory, id=%i.",fd); + } + } + +} + + + +void cmd_sendto(void) +{ + +} + + + +void cmd_recvfrom(void) +{ + +} + + + diff --git a/_rs232/ic_emul/ic_cmds.h b/_rs232/ic_emul/ic_cmds.h new file mode 100644 index 0000000..9226c65 --- /dev/null +++ b/_rs232/ic_emul/ic_cmds.h @@ -0,0 +1,27 @@ + + +#define SOCKET_MAX 20 //max sockets +#define MAX_SELECT 20 //max total sockets for select + +int init(char *comport); +void process(void); + + +void cmd_socket(void); +void cmd_bind(void); +void cmd_connect(void); +void cmd_listen(void); +void cmd_accept(void); +void cmd_close(void); +void cmd_select(void); + +void cmd_gethostbyname(void); +void cmd_gethostbyaddr(void); + +void cmd_send(void); +void cmd_recv(void); +void cmd_sendto(void); +void cmd_recvfrom(void); + + + diff --git a/_rs232/ic_emul/ic_comm.h b/_rs232/ic_emul/ic_comm.h new file mode 100644 index 0000000..fecc993 --- /dev/null +++ b/_rs232/ic_emul/ic_comm.h @@ -0,0 +1,26 @@ + + +#define IC_CMD_SOCKET 0x01 +#define IC_CMD_BIND 0x02 +#define IC_CMD_CONNECT 0x03 +#define IC_CMD_LISTEN 0x04 +#define IC_CMD_ACCEPT 0x05 +#define IC_CMD_CLOSE 0x06 +#define IC_CMD_SELECT 0x07 + +#define IC_CMD_GETHOSTBYNAME 0X20 +#define IC_CMD_GETHOSTBYADDR 0X21 + +#define IC_CMD_SEND 0x10 +#define IC_CMD_RECV 0x11 +#define IC_CMD_SENDTO 0x18 +#define IC_CMD_RECVFROM 0x19 + +#define IC_CMD_RES_OK 0x00 +#define IC_CMD_RES_FAIL 0xff + + + + + + diff --git a/_rs232/ic_emul/ic_main.c b/_rs232/ic_emul/ic_main.c new file mode 100644 index 0000000..6219811 --- /dev/null +++ b/_rs232/ic_emul/ic_main.c @@ -0,0 +1,30 @@ +#include + +#include "ic_comm.h" +#include "ic_cmds.h" +#include "log.h" + + + + + +int main(int argc, char *argv[]) +{ + if(argc<2) + { + log_("Usage: ic_emul.exe COMx"); + return -1; + } + + if(init(argv[1]) < 0) + { + logerr("Init error."); + return -2; + } + + printf("ZX-Spectrum Internet Controller Emulator v0.1\n"); + process(); + + return 0; +} + diff --git a/_rs232/ic_emul/log.c b/_rs232/ic_emul/log.c new file mode 100644 index 0000000..0e257a4 --- /dev/null +++ b/_rs232/ic_emul/log.c @@ -0,0 +1,40 @@ +#include +#include +#include + + +void log_(const char *fmt, ...) +{ +#if 1 + va_list ap; + char *msg=(char*)malloc(1024); + + if(msg) + { + va_start(ap, fmt); + vsprintf(msg, fmt, ap); + printf("Log: %s\n",msg); + va_end(ap); + free(msg); + } +#endif +} + + + +void logerr(const char *fmt, ...) +{ +#if 1 + va_list ap; + char *msg=(char*)malloc(1024); + + if(msg) + { + va_start(ap, fmt); + vsprintf(msg, fmt, ap); + printf("Error: %s\n",msg); + va_end(ap); + free(msg); + } +#endif +} diff --git a/_rs232/ic_emul/log.h b/_rs232/ic_emul/log.h new file mode 100644 index 0000000..c1d653b --- /dev/null +++ b/_rs232/ic_emul/log.h @@ -0,0 +1,6 @@ + + +void log_(const char *fmt, ...); +void logerr(const char *fmt, ...); + + diff --git a/_rs232/ic_emul/make.bat b/_rs232/ic_emul/make.bat new file mode 100644 index 0000000..1e54b6e --- /dev/null +++ b/_rs232/ic_emul/make.bat @@ -0,0 +1,12 @@ +@echo off + +set TOOLS_PATH=... + +set GCC_PATH=%TOOLS_PATH%\mingw\bin;%TOOLS_PATH%\mingw\msys\1.0\bin +set PATH=%GCC_PATH%;%PATH% + +gcc -c ic_main.c -o ic_main.o +gcc -c ic_cmds.c -o ic_cmds.o +gcc -c log.c -o log.o +gcc -c uart.c -o uart.o +gcc ic_main.o ic_cmds.o log.o uart.o -lws2_32 -o ic.exe diff --git a/_rs232/ic_emul/proto.txt b/_rs232/ic_emul/proto.txt new file mode 100644 index 0000000..b744949 --- /dev/null +++ b/_rs232/ic_emul/proto.txt @@ -0,0 +1,162 @@ + + + + +socket +> byte #01 + byte address_family + byte type + byte protocol +< byte res (0=ok) + byte #02 + byte fd + long my_addr + word port +< byte res (0=ok) + +connect +> byte #03 + byte fd + long serv_addr + word port +< byte res (0=ok) + + +listen +> byte #04 + byte fd +< byte res (0=ok)? + + +accept +> byte #05 + byte fd +< byte res (0=ok) + byte #06 + byte fd +< byte res (0=ok) + + +select +> byte #07 + byte fd_read_cnt + byte fd_write_cnt + byte fd_except_cnt + byte fd_read[fd_read_cnt] + byte fd_write[fd_write_cnt] + byte fd_exc[fd_exc_cnt] +< byte res (0=ok) + byte #20 +> word name_len +> ascii hostname +< byte res (0=ok) + byte #21 + long addr + byte type +< byte res (0=ok) + byte #10 + byte fd + word buflen + byte flags +< byte res (0=ok) +>? byte buf[buflen] + byte #11 + byte fd + word len + byte flags +< byte res (0=ok) +>? word reallen +>?? byte buf[reallen] + +sendto +> byte #18 + byte fd + word len + int flags + long to +< byte res (0=ok) +>? byte buf[len] + byte #19 + byte fd + word len +< byte res (0=ok) +>? word reallen +>? byte buf[reallen] + + + + +if_list + +if_config + +proxy_config + +soft_reset + +stats + + + + + + + + + + + + + + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ + + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_INET6 23 /* Internetwork Version 6 */ + + + diff --git a/_rs232/ic_emul/uart.c b/_rs232/ic_emul/uart.c new file mode 100644 index 0000000..a3db5db --- /dev/null +++ b/_rs232/ic_emul/uart.c @@ -0,0 +1,63 @@ +#include + +HANDLE port; +DCB dcb; +COMMTIMEOUTS touts; + + + +//init uart +int uart_init(char *comport) +{ + port = CreateFile(comport, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (port==INVALID_HANDLE_VALUE) return -1; + + if (GetCommState(port, &dcb)) + { + dcb.BaudRate = CBR_115200; + dcb.ByteSize = 8; dcb.Parity = 0; dcb.StopBits = 0; + dcb.fAbortOnError = 0; + SetCommState(port, &dcb); + } + + if (GetCommTimeouts(port, &touts)) + { + touts.ReadIntervalTimeout = MAXDWORD; + touts.ReadTotalTimeoutMultiplier = MAXDWORD; + touts.ReadTotalTimeoutConstant = MAXDWORD; + touts.WriteTotalTimeoutMultiplier = MAXDWORD; + touts.WriteTotalTimeoutConstant = MAXDWORD; + + SetCommTimeouts(port, &touts); + } + +// PurgeComm(port, PURGE_RXCLEAR+PURGE_TXCLEAR); + return 0; +} + + +//read byte (can use int) +void uart_read(char *buf, int len) +{ + unsigned long nread=0,s; + + for(s=0; s +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "ic_comm.h" +#include "ic_cmds.h" +#include "uart.h" +#include "log.h" + +#ifdef __WIN32 +//Winsock shit +WORD wVersionRequested; +WSADATA wsaData; +#else +typedef int SOCKET; +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 +#define closesocket close +#endif + +//vars +SOCKET sockets[SOCKET_MAX]; + + + +//Init +int init(char *sname, int baud) +{ + int i; + + for(i=0; i=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_BIND: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + loc_addr.sin_family = AF_INET; //fix in proto? +#ifdef __WIN32 + loc_addr.sin_addr.S_un.S_addr=htonl(params[1] | (params[2]<<8) | (params[3]<<16) | (params[4]<<24)); +#else + loc_addr.sin_addr.s_addr=htonl(params[1] | (params[2]<<8) | (params[3]<<16) | (params[4]<<24)); +#endif + loc_addr.sin_port=htons(params[5] | (params[6]<<8)); + if(bind(sockets[fd], (struct sockaddr *)&loc_addr, sizeof(loc_addr)) == 0) + { //bind ok + cmd_res_ok(); + log_("Socket id=%i binded to %u.%u.%u.%u:%u.",fd,params[1],params[2],params[3],params[4], params[5] | (params[6]<<8)); + } + else + { //bind error + cmd_res_fail(); + logerr("bind() error."); + } + } +} + + +void cmd_connect(void) +{ + unsigned char params[10]; + unsigned char fd; + struct sockaddr_in rm_addr; + + //get params + uart_read(params,7); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_CONNECT: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + rm_addr.sin_family = AF_INET; //fix in proto? +#ifdef __WIN32 + rm_addr.sin_addr.S_un.S_addr=htonl(params[4] | (params[3]<<8) | (params[2]<<16) | (params[1]<<24)); +#else + rm_addr.sin_addr.s_addr=(params[1] | (params[2]<<8) | (params[3]<<16) | (params[4]<<24)); +#endif + rm_addr.sin_port=htons(params[5] | (params[6]<<8)); + if(connect(sockets[fd], (struct sockaddr *)&rm_addr, sizeof(rm_addr)) == 0) + { //connect ok + cmd_res_ok(); + log_("Socket id=%i connected to %u.%u.%u.%u:%u.",fd,params[1],params[2],params[3],params[4], params[5] | (params[6]<<8)); + } + else + { //connect error + cmd_res_fail(); + logerr("connect() error."); + } + } +} + + + +void cmd_listen(void) +{ + logerr("CMD_LISTEN not implemented yet."); +} + + + +void cmd_accept(void) +{ + logerr("CMD_ACCEPT not implemented yet."); +} + + + +void cmd_close(void) +{ + unsigned char fd; + + //get params + uart_read(&fd,1); + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_CLOSE: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + closesocket(sockets[fd]); + sockets[fd]=0; + cmd_res_ok(); + log_("Close socket, id=%i.",fd); + } +} + + + +void cmd_select(void) +{ + unsigned char params[MAX_SELECT],tlen[3]; + fd_set fdrd; + fd_set fdwr; + fd_set fdexc; + struct timeval tout={0,0}; + int n,nr,nw,ne,i,p; + + //get nums & timeout + uart_read(params,3); + nr=params[0]; + nw=params[1]; + ne=params[2]; + n=nr+ne+nw; + + if(n>MAX_SELECT || nr>MAX_SELECT || nw>MAX_SELECT || ne>MAX_SELECT) + { //too much sockets! error... + while(n>0) + { + nr=(n>MAX_SELECT) ? MAX_SELECT : n; + uart_read(params,nr); + n-=nr; + } + cmd_res_fail(); + logerr("CMD_SELECT: Too much sockets."); + return; + } + else + { //ok, get fds + uart_read(params,n); + FD_ZERO(&fdrd); + FD_ZERO(&fdwr); + FD_ZERO(&fdexc); + + //fill fd_set + if(nr) + { + for(i=0;ih_addr_list[0],4); + uart_write(params,4); + log_("Host %s resolved to %d.%d.%d.%d.",buf, + params[0],params[1],params[2],params[3]); + } + free(buf); + } + else + { + cmd_res_fail(); + logerr("CMD_GETHOSTBYNAME: malloc() failed."); + } +} + + + +void cmd_gethostbyaddr(void) +{ + logerr("CMD_GETHOSTBYADDR not implemented yet."); +} + + + + + +void cmd_send(void) +{ + unsigned char params[10]; + unsigned char fd; + unsigned char *buf; + unsigned short len,sent; + + //get params + uart_read(params,4); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_SEND: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + len=params[1] + 256*params[2]; + buf=(unsigned char*)malloc(len); + + if(buf) + { //mem ok + cmd_res_ok(); + //get data and send it to real socket + uart_read(buf,len); + sent=send(sockets[fd],buf,len,0); + //report real sent/error + params[0]=sent & 0xff; params[1]=(sent>>8) & 0xff; + uart_write(params,2); + + free(buf); + log_("Socket id=%i send %u bytes.",fd,len); + } + else + { //no mem + cmd_res_fail(); + logerr("CMD_SEND: no memory."); + } + } + +} + + + +void cmd_recv(void) +{ + unsigned char params[10]; + unsigned char fd; + unsigned char *buf; + unsigned short len,reallen; + fd_set fdset; + struct timeval tout={0,0}; + int n; + + //get params + uart_read(params,4); + fd=params[0]; + if(fd>=SOCKET_MAX || sockets[fd]==0) + { //wrong fd + cmd_res_fail(); + logerr("CMD_RECV: Wrong socket descriptor, id=%i.",fd); + } + else + { //correct fd + len=params[1] + 256*params[2]; + buf=(unsigned char*)malloc(len+3); + + if(buf) + { //mem ok + FD_ZERO(&fdset); FD_SET(sockets[fd], &fdset); + n=select(FD_SETSIZE, &fdset, NULL, NULL, &tout); + + if(n==0) + { //timeout, no data, socket ok + buf[0]=IC_CMD_RES_OK; + buf[1]=0; + buf[2]=0; + uart_write(buf,3); + log_("Socket id=%i recv 0 bytes.",fd); + } + else if(n==SOCKET_ERROR) + { //socket error + cmd_res_fail(); + logerr("CMD_RECV: socket error (closed?), id=%i.",fd); + } + else + { //data present, read + reallen=recv(sockets[fd],buf+3,len,0); + if(reallen==0) + { //socket closed + cmd_res_fail(); + log_("CMD_RECV: socket closed, id=%i.",fd); + } + else + { + //report real sent/error + buf[0]=IC_CMD_RES_OK; + buf[1]=reallen & 0xff; buf[2]=(reallen>>8) & 0xff; + uart_write(buf,reallen+3); + log_("Socket id=%i recv %u bytes.",fd,reallen); + } + } + free(buf); + } + else + { //no mem + cmd_res_fail(); + logerr("CMD_RECV: no memory, id=%i.",fd); + } + } + +} + + + +void cmd_sendto(void) +{ + logerr("CMD_SENDTO not implemented yet."); +} + + + +void cmd_recvfrom(void) +{ + logerr("CMD_RECVFROM not implemented yet."); +} + + + diff --git a/_rs232/ic_emul_0.2/ic_cmds.h b/_rs232/ic_emul_0.2/ic_cmds.h new file mode 100644 index 0000000..8264da7 --- /dev/null +++ b/_rs232/ic_emul_0.2/ic_cmds.h @@ -0,0 +1,28 @@ + + +#define SOCKET_MAX 20 //max sockets +#define MAX_SELECT 20 //max total sockets for select + +int init(char *sname, int baud); +void process(void); + + +void cmd_nop(void); +void cmd_socket(void); +void cmd_bind(void); +void cmd_connect(void); +void cmd_listen(void); +void cmd_accept(void); +void cmd_close(void); +void cmd_select(void); + +void cmd_gethostbyname(void); +void cmd_gethostbyaddr(void); + +void cmd_send(void); +void cmd_recv(void); +void cmd_sendto(void); +void cmd_recvfrom(void); + + + diff --git a/_rs232/ic_emul_0.2/ic_comm.h b/_rs232/ic_emul_0.2/ic_comm.h new file mode 100644 index 0000000..2f06024 --- /dev/null +++ b/_rs232/ic_emul_0.2/ic_comm.h @@ -0,0 +1,27 @@ + + +#define IC_CMD_NOP 0x00 +#define IC_CMD_SOCKET 0x01 +#define IC_CMD_BIND 0x02 +#define IC_CMD_CONNECT 0x03 +#define IC_CMD_LISTEN 0x04 +#define IC_CMD_ACCEPT 0x05 +#define IC_CMD_CLOSE 0x06 +#define IC_CMD_SELECT 0x07 + +#define IC_CMD_GETHOSTBYNAME 0X20 +#define IC_CMD_GETHOSTBYADDR 0X21 + +#define IC_CMD_SEND 0x10 +#define IC_CMD_RECV 0x11 +#define IC_CMD_SENDTO 0x18 +#define IC_CMD_RECVFROM 0x19 + +#define IC_CMD_RES_OK 0x00 +#define IC_CMD_RES_FAIL 0xff + + + + + + diff --git a/_rs232/ic_emul_0.2/ic_main.c b/_rs232/ic_emul_0.2/ic_main.c new file mode 100644 index 0000000..05770fc --- /dev/null +++ b/_rs232/ic_emul_0.2/ic_main.c @@ -0,0 +1,70 @@ +#include +#include +#include + +#include "ic_comm.h" +#include "ic_cmds.h" +#include "log.h" + +int debug=0; + +void usage(void) +{ +#ifdef __WIN32 + printf("Usage: ic.exe COMx [-b baudrate] [-q] [-q]\n\n"); +#else + printf("Usage: ic /dev/ttyUSBx [-b baudrate] [-q] [-q]\n\n"); +#endif + printf("Supported baud rates: 115200 (default), 57600, 38400,\n"); + printf(" 19200, 9600, 4800, 2400, 1200\n"); + printf("Use single -q for quiet mode,\n"); + printf("double -q for complete silence.\n"); +} + + +int main(int argc, char *argv[]) +{ + char *sname=NULL,*p; + int i, baud=115200, q=0; + + for (i = 1; i < argc; i++) + { + p = argv[i]; + if (*p == '-') + { + if (strcmp(p, "-b") == 0) baud = atoi(argv[++i]); + else if (strcmp(p, "-q") == 0) q++; + else if (strcmp(p, "-d") == 0) debug=1; + } + else if (!sname) sname = p; + else + { + usage(); + return -1; + } + } + + if(!sname) + { + usage(); + return -1; + } + + loginit(q); + + if(init(sname, baud) < 0) + { + logerr("Init error."); + return -2; + } + + if(q<2) + { + printf("ZX-Spectrum Internet Controller Emulator v0.2.\n"); + printf("Serial device used: %s at %d baud.\n", sname, baud); + } + + process(); + return 0; +} + diff --git a/_rs232/ic_emul_0.2/log.c b/_rs232/ic_emul_0.2/log.c new file mode 100644 index 0000000..6fdd8bd --- /dev/null +++ b/_rs232/ic_emul_0.2/log.c @@ -0,0 +1,50 @@ +#include +#include +#include + +int loglvl=0; + +void loginit(int lvl) +{ + loglvl=lvl; +} + +void log_(const char *fmt, ...) +{ + if(loglvl>0) + return; +#if 1 + va_list ap; + char *msg=(char*)malloc(1024); + + if(msg) + { + va_start(ap, fmt); + vsprintf(msg, fmt, ap); + printf("Log: %s\n",msg); + va_end(ap); + free(msg); + } +#endif +} + + + +void logerr(const char *fmt, ...) +{ + if(loglvl>1) + return; +#if 1 + va_list ap; + char *msg=(char*)malloc(1024); + + if(msg) + { + va_start(ap, fmt); + vsprintf(msg, fmt, ap); + printf("Error: %s\n",msg); + va_end(ap); + free(msg); + } +#endif +} diff --git a/_rs232/ic_emul_0.2/log.h b/_rs232/ic_emul_0.2/log.h new file mode 100644 index 0000000..3ecff4d --- /dev/null +++ b/_rs232/ic_emul_0.2/log.h @@ -0,0 +1,7 @@ + + +void loginit(int lvl); +void log_(const char *fmt, ...); +void logerr(const char *fmt, ...); + + diff --git a/_rs232/ic_emul_0.2/make.bat b/_rs232/ic_emul_0.2/make.bat new file mode 100644 index 0000000..98f2d87 --- /dev/null +++ b/_rs232/ic_emul_0.2/make.bat @@ -0,0 +1,12 @@ +@echo off + +set TOOLS_PATH=D:\proj\zx\floppy-disk-ripper\_tools + +set GCC_PATH=%TOOLS_PATH%\mingw\bin;%TOOLS_PATH%\mingw\msys\1.0\bin +set PATH=%GCC_PATH%;%PATH% + +gcc -Wall -Wno-pointer-sign -c ic_main.c -o ic_main.o +gcc -Wall -Wno-pointer-sign -c ic_cmds.c -o ic_cmds.o +gcc -Wall -Wno-pointer-sign -c log.c -o log.o +gcc -Wall -Wno-pointer-sign -c uart_win.c -o uart.o +gcc ic_main.o ic_cmds.o log.o uart.o -lws2_32 -o ic.exe \ No newline at end of file diff --git a/_rs232/ic_emul_0.2/make.sh b/_rs232/ic_emul_0.2/make.sh new file mode 100644 index 0000000..3268bb5 --- /dev/null +++ b/_rs232/ic_emul_0.2/make.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +gcc -Wall -Wno-pointer-sign -c ic_main.c -o ic_main.o +gcc -Wall -Wno-pointer-sign -c ic_cmds.c -o ic_cmds.o +gcc -Wall -Wno-pointer-sign -c log.c -o log.o +gcc -Wall -Wno-pointer-sign -c uart_lin.c -o uart.o + +gcc ic_main.o ic_cmds.o log.o uart.o -o ic diff --git a/_rs232/ic_emul_0.2/proto.txt b/_rs232/ic_emul_0.2/proto.txt new file mode 100644 index 0000000..b744949 --- /dev/null +++ b/_rs232/ic_emul_0.2/proto.txt @@ -0,0 +1,162 @@ + + + + +socket +> byte #01 + byte address_family + byte type + byte protocol +< byte res (0=ok) + byte #02 + byte fd + long my_addr + word port +< byte res (0=ok) + +connect +> byte #03 + byte fd + long serv_addr + word port +< byte res (0=ok) + + +listen +> byte #04 + byte fd +< byte res (0=ok)? + + +accept +> byte #05 + byte fd +< byte res (0=ok) + byte #06 + byte fd +< byte res (0=ok) + + +select +> byte #07 + byte fd_read_cnt + byte fd_write_cnt + byte fd_except_cnt + byte fd_read[fd_read_cnt] + byte fd_write[fd_write_cnt] + byte fd_exc[fd_exc_cnt] +< byte res (0=ok) + byte #20 +> word name_len +> ascii hostname +< byte res (0=ok) + byte #21 + long addr + byte type +< byte res (0=ok) + byte #10 + byte fd + word buflen + byte flags +< byte res (0=ok) +>? byte buf[buflen] + byte #11 + byte fd + word len + byte flags +< byte res (0=ok) +>? word reallen +>?? byte buf[reallen] + +sendto +> byte #18 + byte fd + word len + int flags + long to +< byte res (0=ok) +>? byte buf[len] + byte #19 + byte fd + word len +< byte res (0=ok) +>? word reallen +>? byte buf[reallen] + + + + +if_list + +if_config + +proxy_config + +soft_reset + +stats + + + + + + + + + + + + + + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ + + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_INET6 23 /* Internetwork Version 6 */ + + + diff --git a/_rs232/ic_emul_0.2/uart.h b/_rs232/ic_emul_0.2/uart.h new file mode 100644 index 0000000..1e67f60 --- /dev/null +++ b/_rs232/ic_emul_0.2/uart.h @@ -0,0 +1,10 @@ + + + +int uart_init(char *sname, int baud); +void uart_read(char *buf, int len); +void uart_write(char *buf, int len); + + + + diff --git a/_rs232/ic_emul_0.2/uart_lin.c b/_rs232/ic_emul_0.2/uart_lin.c new file mode 100644 index 0000000..a3f9eda --- /dev/null +++ b/_rs232/ic_emul_0.2/uart_lin.c @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "uart.h" + +#define BAUD_ERROR -1U +int fd; +extern int debug; + + +static tcflag_t get_baud(int baud) +{ + switch(baud) + { + case 115200: return B115200; + case 57600: return B57600; + case 38400: return B38400; + case 19200: return B19200; + case 9600: return B9600; + case 4800: return B4800; + case 2400: return B2400; + case 1200: return B1200; + default: return BAUD_ERROR; + } +} + + +//init uart +int uart_init(char *sname, int baud) +{ + struct termios /*otio,*/ ntio; + tcflag_t BAUD; + + //check/get baud rate + BAUD = get_baud(baud); + if(BAUD==BAUD_ERROR) return -1; + + //open tty + fd = open(sname, O_RDWR | O_NOCTTY); + if(fd<0) return -1; + + //save current port settings + //tcgetattr(fd,&otio); + + //set config + bzero(&ntio, sizeof(ntio)); + ntio.c_cflag = BAUD | //baud rate + CS8 | //8n1 + CLOCAL | //local connection, no modem control + CREAD; //enable receiving characters + ntio.c_iflag = IGNPAR; //ignore bytes with parity errors + ntio.c_oflag = 0; //raw output + ntio.c_lflag = 0; //non-canonical input + + ntio.c_cc[VMIN] = 1; //wait for 1 byte minimum + + //flush and apply new settings + tcflush(fd, TCIFLUSH); + tcsetattr(fd,TCSANOW,&ntio); + return 0; +} + + +//read bytes +void uart_read(char *buf, int len) +{ + unsigned long s=0; + + while(s +#include + +HANDLE port; +DCB dcb; +COMMTIMEOUTS touts; +extern int debug; + +#define BAUD_ERROR -1U + + +static DWORD get_baud(int baud) +{ + switch(baud) + { + case 115200: return CBR_115200; + case 57600: return CBR_57600; + case 38400: return CBR_38400; + case 19200: return CBR_19200; + case 9600: return CBR_9600; + case 4800: return CBR_4800; + case 2400: return CBR_2400; + case 1200: return CBR_1200; + default: return BAUD_ERROR; + } +} + + + + + +//init uart +int uart_init(char *sname, int baud) +{ + char buf[16], *p; + DWORD CBR; + + //fix COMx name to \\.\COMx + if(strncasecmp(sname,"com",3)==0 && strlen(sname)<7) + { + sprintf(buf,"\\\\.\\%s",sname); + p=buf; + } + else + { + p=sname; + } + + //check/get baud rate + CBR = get_baud(baud); + if(CBR==BAUD_ERROR) return -1; + + //open serial line + port = CreateFile(p, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (port==INVALID_HANDLE_VALUE) return -1; + + //set config + if (GetCommState(port, &dcb)) + { + dcb.BaudRate = CBR; //CBR_57600; //CBR_115200; + dcb.ByteSize = 8; dcb.Parity = 0; dcb.StopBits = 0; + dcb.fAbortOnError = 0; + SetCommState(port, &dcb); + } + + //set timeouts + if (GetCommTimeouts(port, &touts)) + { + touts.ReadIntervalTimeout = MAXDWORD; + touts.ReadTotalTimeoutMultiplier = MAXDWORD; + touts.ReadTotalTimeoutConstant = MAXDWORD; + touts.WriteTotalTimeoutMultiplier = MAXDWORD; + touts.WriteTotalTimeoutConstant = MAXDWORD; + + SetCommTimeouts(port, &touts); + } + + PurgeComm(port, PURGE_RXCLEAR+PURGE_TXCLEAR); + return 0; +} + + +//read bytes +void uart_read(char *buf, int len) +{ + unsigned long nread=0,s; + + for(s=0; s byte #01 +; byte address_family +; byte type +; byte protocol +;< byte res (0=ok) +; byte #02 +; byte fd +; long my_addr +; word port +;< byte res (0=ok) + +;IN: +;a=fd +;hl=address of ip and port (db a,b,c,d:dw port) +;OUT: +;a=res (0=ok) +bind + ex de,hl + ld hl,cmd_buffer + ld (hl),IC_CMD_BIND:inc hl + ld (hl),a:inc hl + ex de,hl + ld bc,6:ldir ;copy ip+port + + ld hl,cmd_buffer,c,8 + call uart.Write + call uart.GetChar + ret + + + + +;connect() +;> byte #03 +; byte fd +; long serv_addr +; word port +;< byte res (0=ok) + +;IN: +;a=fd +;hl=address of ip and port (db a,b,c,d:dw port) +;OUT: +;a=res (0=ok) +connect + ex de,hl + ld hl,cmd_buffer + ld (hl),IC_CMD_CONNECT:inc hl + ld (hl),a:inc hl + ex de,hl + ld bc,6:ldir ;copy ip+port + + ld hl,cmd_buffer,c,8 + call uart.Write + call uart.GetChar + ret + + + + + +;close() +;> byte #06 +; byte fd +;< byte res (0=ok) + +;IN: +;a=fd +;OUT: +;a=res (0=ok) +close + push af + ld a,IC_CMD_CLOSE:call uart.PutChar + pop af:call uart.PutChar + call uart.GetChar + ret + + + + + +;send() +;> byte #10 +; byte fd +; word buflen +; byte flags +;< byte res (0=ok) +;>? byte buf[buflen] +; byte #11 +; byte fd +; word len +; byte flags +;< byte res (0=ok) +;>? word reallen +;>?? byte buf[reallen] + +;IN: +;a=fd +;hl=buf +;bc=len +;OUT: +;a=res (0=ok) +;bc=reallen +recv + ld (recv1+1),hl ;save buf addr + ld hl,cmd_buffer + ld (hl),IC_CMD_RECV:inc hl + ld (hl),a:inc hl + ld (hl),c:inc hl + ld (hl),b:inc hl + ld (hl),0 ;flags, skipped now + + ld hl,cmd_buffer,bc,5 + call uart.Write + call uart.GetChar + or a:ret nz ;ret if error + + call uart.GetChar + push af + call uart.GetChar + ld b,a + pop af + ld c,a ;bc=real len + ld a,b + or c + jr z,recv_skip + push bc +recv_skip_header ld a,0 + or a + jr nz,recv1 + push bc + pop hl +; skip http header +2 call uart.GetChar + dec hl + cp #0d + jr nz,2b + call uart.GetChar + dec hl + cp #0a + jr nz,2b + call uart.GetChar + dec hl + cp #0d + jr nz,2b + call uart.GetChar + dec hl + cp #0a + jr nz,2b + ld b,h + ld c,l + ld (recv_skip_header+1),a + pop hl + push bc +recv1 ld hl,0 + call uart.Read ;get data + pop bc +recv_skip + xor a + ret + + + + + + + + + + + + +;gethostbyname +;> byte #20 +;> word name_len +;> ascii hostname +;< byte res (0=ok) +;= ширины окна, либо если есть линковка) + +#09 - инверсия цвета (меняет папер и инк местами) + +#01-08 цветовые коды, задается цвет для чернил +(1 - синий, 7 - белый, 8 - черный) + +#01-#08,#01-#08 задание цветов папер+инк +(1 -черный, 8 - белый) +в случае, когда цвет чернил и бумаги одинаковый, то +выставляется фоновый папер с ярким инком! +(при этом: 1,1 - ярко синий, 7,7 - ярко белый) + + + +Initialisations: +------------------------------------------------------ +86¦INT_PL + ¦i:A' + ¦ #00 - disable all INT functions, while plugin running + ¦ #01 - отключить обновление времени на TXT-экране + ¦ #02 - отключить опрос PS/2 клавиатуры на прерываниях + ¦ + ¦ #FF - включение и инициализация обработчика INT от плагина + ¦ i:HL - адрес обработчика в плагине (#8000-#BFFE) + ¦ + ¦по выходу из плагина все параметры восстанавливаются! +--+--------------------------------------------------- + +Main Functions: +------------------------------------------------------ + 0¦MNGC_PL + ¦включение страницы на #C000 (из выделенного блока) + ¦нумерация совпадает с использующейся в +36 + ¦i:A' - номер страницы (от 0) + ¦ #FF - страница с фонтом (1го текстового экрана) + ¦ #FE - первый текстовый экран (в нём панели) +--+--------------------------------------------------- +78¦MNG0_PL + ¦включение страницы на #0000 (из выделенного блока) + ¦i:A' - номер страницы (от 0) + ¦не влияет на работу FAT драйвера, НО все структуры + ¦которые будут подаваться файловым функциям, должны + ¦лежать в адресах #8000-#FFFF! +--+--------------------------------------------------- +79¦MNG8_PL + ¦включение страницы на #8000 (из выделенного блока) + ¦i:A' - номер страницы (от 0) +--+--------------------------------------------------- + 1¦PRWOW + ¦вывод окна на экран + ¦(включает основной ТХТ экран в #C000) + ¦i:IX - адрес по которому лежит структура окна (SOW) +--+--------------------------------------------------- + 2¦RRESB + ¦стирание окна (восстановление информации) + ¦(включает основной ТХТ экран в #C000) + ¦i:IX - SOW +--+--------------------------------------------------- + 3¦PRSRW + ¦(включает основной ТХТ экран в #C000) + ¦печать строки в окне + ¦i:IX - SOW + ¦ HL - Text addres (должен быть в #8000-#BFFF!) + ¦ D - Y + ¦ E - X + ¦ BC - Lenght +--+--------------------------------------------------- + 4¦PRIAT + ¦выставление цвета (вызывается сразу после PRSRW) + ¦i:PRSRW - выставленные координаты и длина + ¦ A' - цвет +--+--------------------------------------------------- + 5¦GADRW + ¦получение адреса в окне + ¦(включает основной ТХТ экран в #C000) + ¦i:IX - SOW + ¦ D - Y + ¦ E - X + ¦o:HL - Address +--+--------------------------------------------------- + 6¦CURSOR + ¦печать курсора + ¦i:IX - SOW +--+--------------------------------------------------- + 7¦CURSER + ¦стирание курсора (восстановление цвета) + ¦i:IX - SOW +--+--------------------------------------------------- + 8¦YN + ¦меню ok/cancel + ¦i:A' + ¦ #01 - инициализация (вычисляет координаты) + ¦ #00 - обработка нажатий (вызывать раз в фрейм) + ¦ #FF - выход + ¦ o:NZ - выбран CANCEL + ¦ Z - выбран OK +--+--------------------------------------------------- + 9¦ISTR + ¦редактирование строки, вывод индикации, опрос состояний + ¦i:A' + ¦ #FF - инициализация, тип 0 (рисует курсор) + ¦ i:HL - адрес строки (на экране) + ¦ DE - CURMAX+CURNOW (длина строки + ¦ + начальная позиция курсора в ней) + ¦ #00 - опрос клавиатуры + ¦ [опрашивает LF,RG,BackSpace,Delete,Insert,] + ¦ [ctrl+shift... ] + ¦ [собственно редактируется строка,] + ¦ [нужно вызывать каждый фрейм ] + ¦ #01 - выход (стирает курсор) + ¦ o:HL - адрес строки + ¦ + ¦ #FD - инициализация, тип 2 (рисует курсор) + ¦ i:HL - адрес строки (буфер) + ¦ HL'- размер буфера + ¦ D - Y внутри окна + ¦ E - X внутри окна + ¦ BC - CURMAX+CURNOW + ¦ (размер окна вывода + позиц. курсора) + ¦ #02 - вывод на экран блока из буфера с курсором + ¦ (вызывать каждый фрейм, вместе с #00 и #03) + ¦ + ¦ #FE - инициализация индикации + ¦ (INS/OVR + ENG/RUS + CAPS) + ¦ i: H - 0:выводить в верхнем заголовке окна + ¦ 1:выводить в нижнем заголовке окна + ¦ L - reserved (#FF) + ¦ #03 - обновление индикаторов (вывод) + ¦ + ¦ #FC - опрос CAPS, INS, CTRL+SHIFT + ¦ изменяет соотв. состояния, вызывать каждое + ¦ прерывание. + ¦ i:none + ¦ o: A - состояния + ¦ [7]: %0 - INS + ¦ %1 - OVR + ¦ [6]: %0 - CAPS off + ¦ %1 - CAPS on + ¦ [5-2]:reserved + ¦ [1-0]:%00 - ENG + ¦ %01 - RUS + ¦ %10 - reserved + ¦ %11 - reserved + ¦ + ¦после инициализации тип 0: + ¦можно вызывать только #00, #01, а так же #FE+#03! + ¦ + ¦после инициализации тип 2: + ¦нужно вызывать #00 и #02 каждый фрейм + ¦в #00 идет редактирование буфера и вывод курсора, а + ¦по #02 идет вывод на экран текста, в область задан- + ¦ную координатами XY и шириной=CURMAX. + ¦так же можно вызывать #FE+#03 + ¦ + ¦недопустимо одновременно вызывать #00 и #FC!!! +--+--------------------------------------------------- +10¦NORK + ¦перевод байта в HEX (текстовый формат) + ¦i:HL - Text Address + ¦ A - Value +--+--------------------------------------------------- +11¦TXTPR + ¦вывод текста в окне + ¦i:IX - SOW + ¦ HL - адрес текста (строки/абзаца) + ¦ D - Y (внутри окна) + ¦ E - X (внутри окна) + ¦ + ¦o: D - Y (след строка) + ¦ E - X (без изменений) +--+--------------------------------------------------- +12¦MEZZ + ¦вывод сообщения в окне + ¦i:IX - SOW + ¦ A - номер сообщения/абзаца + ¦ HL - адрес текстового блока с сообщениями + ¦ D - Y (внутри окна) + ¦ E - X (внутри окна) + ¦ + ¦o: D - Y (след строка) + ¦ E - X (без изменений) +--+--------------------------------------------------- +84¦SCRLWOW + ¦сдвинуть содержимое области в окне + ¦i: D - Y + ¦ E - X + ¦ B - Height + ¦ C - Width + ¦ A'- [7]:%1 - with attributes + ¦ %0 - chars only + ¦ [6]:%1 - clear source side (after scroll) + ¦ %0 - don't clear + ¦ [5-2]:%0000 - 1 char step + ¦ %1111 - 16 chars step + ¦ [1-0]:%00 - scroll down + ¦ %01 - up + ¦ %10 - right (disabled) + ¦ %11 - left (disabled) + ¦ + ¦если координаты области и её размер позволяют использовать + ¦DMA, то пересылка будет идти через неё. + ¦также биты [7-2] должны быть в нуле!!! +--+--------------------------------------------------- +13¦DMAPL + ¦работа с DMA + ¦i: A' - тип операции + ¦#00 - инит S и D (BHL - Source, CDE - Destination) + ¦#01 - инит S (BHL) + ¦#02 - инит D (CDE) + ¦#03 - инит S с пагой из окна (HL, B - 0-3 [номер окна]) + ¦#04 - инит D с пагой из окна (HL, B - 0-3 [номер окна]) + ¦#05 - выставление DMA_T (B - кол-во бёрстов) + ¦#06 - выставление DMA_N (B - размер бёрста) + ¦ + ¦#07 - выставить DMA_T+DMA_N (B - кол-во бёрстов, C - размер) + ¦#08 - выставить SourceAlign (C - 0/1 off/on) + ¦#09 - выставить DestinationAlign (C - 0/1 off/on) + ¦#0A - выставить AlignSize (C - 0/1 16c/256c) + ¦#0B - выставить AlignSize+Source+Destination + ¦ i:E=0/1 (16c/256c Align) + ¦ H=0/1 (off/on SourceAlign) + ¦ L=0/1 (off/on DestinationAlign) + ¦ + ¦#FC - запуск DMA RAM->RAM + ¦#FB - запуск DMA BLT->RAM + ¦#FA - запуск DMA FILL + ¦#F9 - запуск DMA RAM->CRAM + ¦#F8 - запуск DMA RAM->SFILE + ¦ + ¦#FD - запуск DMA RAM->RAM без ожидания завершения (Align=0!) + ¦#FE - запуск DMA RAM->RAM с ожиданием завершения (Align=0!) + ¦#FF - ожидание готовности дма + ¦ + ¦в функциях #00-#02 формат B/C следующий: + ¦ [7]:%1 - выбор страницы из блока выделенного плагину (0-5) + ¦ %0 - выбор страницы из видео буферов (0-63) + ¦ [6-0]:номер страницы +--+--------------------------------------------------- +14¦TURBOPL + ¦i:B - выбор Z80/AY + ¦ #00 - меняется частота Z80 + ¦ i:C - %00 - 3.5 MHz + ¦ %01 - 7 MHz + ¦ %10 - 14 MHz + ¦ %11 - 28 MHz (в данный момент 14MHz) + ¦ #01 - меняется частота AY + ¦ i:C - %00 - 1.75 MHz + ¦ %01 - 1.7733 MHz + ¦ %10 - 3.5 MHz + ¦ %11 - 3.546 MHz +--+--------------------------------------------------- +15¦GEDPL + ¦восстановление паллитры, всех оффсетов и txt режима + ¦ !обязательно вызывать при запуске плагина! + ¦ (включает основной txt экран) + ¦i:none +--+--------------------------------------------------- + + +Keyboard: +если возвращает NZ, то клавиша нажата. +------------------------------------------------------ +16¦SPKE (SPACE) +--+--------------------------------------------------- +17¦UPPP (UP Arrow) +--+--------------------------------------------------- +18¦DWWW (Down Arrow) +--+--------------------------------------------------- +19¦LFFF (Left Arrow) +--+--------------------------------------------------- +20¦RGGG (Right Arrow) +--+--------------------------------------------------- +21¦TABK (Tab) +--+--------------------------------------------------- +22¦ENKE (Enter) +--+--------------------------------------------------- +23¦ESC +--+--------------------------------------------------- +24¦BSPC (Backspace) +--+--------------------------------------------------- +25¦PGU (pgUP) +--+--------------------------------------------------- +26¦PGD (pgDN) +--+--------------------------------------------------- +27¦HOME +--+--------------------------------------------------- +28¦END +--+--------------------------------------------------- +29¦F1 +--+--------------------------------------------------- +30¦F2 +--+--------------------------------------------------- +31¦F3 +--+--------------------------------------------------- +32¦F4 +--+--------------------------------------------------- +33¦F5 +--+--------------------------------------------------- +34¦F6 +--+--------------------------------------------------- +35¦F7 +--+--------------------------------------------------- +36¦F8 +--+--------------------------------------------------- +37¦F9 +--+--------------------------------------------------- +38¦F10 +--+--------------------------------------------------- +39¦ALT (не трогает авторепиты) +--+--------------------------------------------------- +40¦SHIFT (не трогает авторепиты) +--+--------------------------------------------------- +41¦CTRL (не трогает авторепиты) +--+--------------------------------------------------- +42¦KBSCN + ¦опрос клавиш + ¦i:A' - обработчик + ¦ #00 - учитывает SHIFT, CL, а так же ENG/RUS + ¦ (можно вызывать только 1 раз в фрейм) + ¦ #01 - всегда выдает код из TAIE1 + ¦ (можно вызывать несколько раз за фрейм) + ¦ + ¦!KBSCN нужно вызывать до вызова опроса SHIFT и CTRL + ¦ + ¦o: NZ: A - TAIE1/TAIE2/TAIR1/TAIR2 (see PS2P.ASM) + ¦ Z: A=#00 - unknown key (also no chars) + ¦ A=#FF - buffer end (impossibru!) +--+--------------------------------------------------- +43¦DEL (Delete) +--+--------------------------------------------------- +85¦INS (Insert) +--+--------------------------------------------------- +44¦CAPS (Caps Lock) +--+--------------------------------------------------- +45¦ANYK (any key) +--+--------------------------------------------------- +46¦USPO +--+--------------------------------------------------- +47¦NUSP (waiting for any key) +--+--------------------------------------------------- + + +File Operations: +------------------------------------------------------ +48¦LOAD512 + ¦потоковая загрузка файла + ¦i:HL - Address + ¦ B - Blocks (512b) + ¦o:HL - New Value + ¦ A - EndOfChain (#0F) +--+--------------------------------------------------- +49¦SAVE512 + ¦потоковая запись файла + ¦i:HL - Address + ¦ B - Blocks (512b) + ¦o:HL - New Value + ¦ A - EndOfChain (#0F) +--+--------------------------------------------------- +50¦GIPAGPL + ¦позиционировать на начало файла + ¦(сразу после запуска плагина оная уже вызвана) +--+--------------------------------------------------- +51¦TENTRY + ¦получить ENTRY(32) из коммандера + ¦(структура как в каталоге FAT32) + ¦i: DE - Address + ¦o:DE(32) - ENTRY +--+--------------------------------------------------- +52¦CHTOSEP + ¦разложение цепочки активного файла в сектора + ¦i:DE - BUFFER (куда кидать номера секторов) + ¦ BC - BUFFER END (=BUFFER+BUFFERlenght) +--+--------------------------------------------------- +53¦TENTRYN +--+--------------------------------------------------- +54¦TMRKDFL + ¦получить заголовок маркированного файла + ¦i:IX - Active panel!!! + ¦ HL - File number (1-2047) + ¦ DE - Address [#8000-#BFFF!] + ¦ (if HL=0; o:BC - count of marked files) + ¦ + ¦o:NZ - File not found or other error + ¦ Z - File name received ("name.ext",0) + ¦ [так же делается позиционирование на начало + ¦ [этого файла, если bit 7,H не в 1!!! + ¦ [соотв. функции LOAD512/SAVE512 будут читать/ + ¦ [писать этот файл от начала. +--+--------------------------------------------------- +55¦TMRKNXT +--+--------------------------------------------------- +56¦ +--+--------------------------------------------------- +57¦STREAM + ¦работа с потоками + ¦i:D - #FF: сделать активным root dir + ¦ (более никаких параметров не учитывает) + ¦ + ¦ #FE: клонировать поток из активной панели + ¦ в потоки #01 и #02. + ¦ Автоматически делается активным поток #01 + ¦ (никаких других параметров не учитывает) + ¦ + ¦ #00/#01: номер потока, требует BC. + ¦ i:B - устройство + ¦ (0-SD(ZC),1-NemoMaster,2-NemoSlave) + ¦ (4-SmucMaster,5-SmucSlave) + ¦ C - раздел (не учитывается) + ¦ BC=#FFFF: включает поток из D (не возвращает флагов) + ¦BC<>#FFFF: создает/пересоздает поток. + ¦ + ¦o:NZ - устройство или раздел не найдены + ¦ Z - можно начинать работать с потоком +--+--------------------------------------------------- +58¦FindNext + ¦получение очередного имени файла/каталога + ¦(сбрасывается после GDIR) + ¦i:DE - Address + ¦ A - [7]:%1 - only short names + ¦ [6-5]:reserved + ¦ [4]:%1 - enable created time field + ¦ [3]:%1 - enable created date field + ¦ [2]:%1 - enable size field + ¦ [1-0]:%00 find next Entry + ¦ %01 find next File + ¦ %10 find next DIR + ¦ %11 reserved + ¦ + ¦o: Z - End Of Dir + ¦ NZ - Buffer updated + ¦ DE - [size(4)], + ¦ [date(2)], + ¦ [time(2)], + ¦ flag(1),Entry Name(1-255),0 +--+--------------------------------------------------- +59¦FENTRY + ¦поиск файла/каталога в активной директории + ¦(так же можно подавать путь к файлу/каталогу) + ¦i:HL - flag(1),name/path(1-255/1-XXX),#00 + ¦flag:#00 - file + ¦ #10 - dir + ¦name:"name.txt","directory"... + ¦ + ¦o: Z - entry not found + ¦ NZ - [DE,HL] - file length + ¦ CALL GFILE/GDIR for activating file/dir +--+--------------------------------------------------- +60¦LOAD256 + ¦функция используется видео плеером +--+--------------------------------------------------- +61¦LOADNONE + ¦пропустить N секторов + ¦(параметры те же, что и в LOAD512) +--+--------------------------------------------------- +62¦GFILE + ¦выставить указатель на начало найденного файла + ¦(вызывается после FENTRY!) +--+--------------------------------------------------- +63¦GDIR + ¦сделать найденный каталог активным + ¦(вызывается после FENTRY!) +--+--------------------------------------------------- +72¦MKfile + ¦создание файла в активном каталоге + ¦i:HL - flag(1),length(4),name(1-255),#00 + ¦ + ¦o:NZ - Operation failed + ¦ Z - File created + ¦ o:ENTRY(32) [use TENTRY] + ¦ + ¦[после создания файла происходит позиционирование + ¦[на его начало!!! +--+--------------------------------------------------- +73¦MKdir + ¦создание каталога в активной директории + ¦i:HL - name(1-255),#00 + ¦ + ¦o:NZ - Operation failed + ¦ Z - Directory created +--+--------------------------------------------------- +74¦REName + ¦переименование файла/каталога + ¦i:HL - flag(1),oldname(1-255),0 + ¦ DE - newname(1-255),0 + ¦ + ¦o: Z - not found or new name already exists + ¦ NZ - success +--+--------------------------------------------------- +75¦DelFl + ¦удаление файла/каталога + ¦i: HL - flag(1),name(1-255),#00 + ¦ + ¦o: Z - File/DIR Not Found + ¦ NZ - File/DIR Deleted +--+--------------------------------------------------- + + + +Graphics: +------------------------------------------------------ +64¦MNGV_PL + ¦включение видео страницы + ¦i:A' - номер видео страницы + ¦ #00 - основной экран (тхт) + ¦ [паллитра выставляется автоматом] + ¦ [как и все режимы и смещения ] + ¦ #01 - 1й видео буфер (16 страниц) + ¦ #02 - 2й видео буфер (16 страниц) + ¦ #03 - 3й видео буфер (16 страниц) + ¦ #04 - 4й видео буфер (16 страниц) +--+--------------------------------------------------- +65¦MNGCVPL + ¦включение страницы из видео буферов на #C000 + ¦i:A' - номер страницы + ¦ #00-#0F - страницы из 1го видео буфера + ¦ #10-#1F - страницы из 2го видео буфера + ¦ #20-#2F - страницы из 3го видео буфера + ¦ #30-#3F - страницы из 4го видео буфера +--+--------------------------------------------------- +80¦MNG0VPL + ¦включение страницы из видео буферов на #0000 + ¦i:A' - номер страницы + ¦нужно учитывать, что в адресах #2000-#7FFF находится + ¦fat драйвер и ядро системы! + ¦на время вызова функций, страница переключается, затем + ¦всё восстанавливается как было... + ¦ + ¦НЕДОПУСТИМО передавать какие-либо параметры, из + ¦области #0000-#7FFF fat драйверу!!! +--+--------------------------------------------------- +81¦MNG8VPL + ¦включение страницы из видео буферов на #8000 + ¦i:A' - номер страницы +--+--------------------------------------------------- +66¦GVmod + ¦включение видео режима (разрешение+тип) + ¦i:A' - видео режим + ¦ [7-6]:%00 - 256x192 + ¦ %01 - 320x200 + ¦ %10 - 320x240 + ¦ %11 - 360x288 + ¦ [5]:%x - nogfx + ¦ [4]:%x - notsu + ¦ [3]:%0 - reserved + ¦ [2]:%0 - reserved + ¦ [1-0]:%00 - ZX + ¦ %01 - 16c + ¦ %10 - 256c + ¦ %11 - txt +--+--------------------------------------------------- +67¦GYoff + ¦выставление смещения экрана по Y + ¦i:HL - Y (0-511) +--+--------------------------------------------------- +68¦GXoff + ¦выставление смещения экрана по X + ¦i:HL - X (0-511) +--+--------------------------------------------------- +69¦GVtm + ¦выставление страницы для TileMap + ¦i:C - номер страницы из видео буфера (0-63) +--+--------------------------------------------------- +70¦GVtl + ¦выставление страницы для TileGraphics + ¦i:B - номер тайло-плоскости (0-1) + ¦ C - номер страницы из видео буфера (0-63) +--+-------------------------------------------------- +71¦GVsgp + ¦выставление страницы для SpriteGraphics + ¦i:C - номер страницы из видео буфера (0-63) +--+--------------------------------------------------- diff --git a/_sd/VBI.ASM b/_sd/VBI.ASM new file mode 100644 index 0000000..0bb95e2 --- /dev/null +++ b/_sd/VBI.ASM @@ -0,0 +1 @@ + ORG #C000 ;------- INTM EQU #FEFF PE0 EQU #21AF ;------- LD HL,I_N_T,(INTM+0),HL LD HL,#C9FB,(INTM+2),HL DI LD A,INTM[,I,A:IM 2 EI ;------- LD BC,PE0,A,%00001110:OUT A LD BC,#10AF,A,#0F:OUT A LD HL,VAGA,DE,CORE LD BC,VAGAE-VAGA:LDIR ;--------------------------------------- CALL DOS_SWP; DEPACK Driver CALL DEV_INI:JP NZ,ER0 CALL HDD:JP NZ,ER1 CALL SETROOT; SET ROOT DIR ;CALL VYGREB; ‚ë£ॡ ¥¬ ª ⠫®£, ç¨áâ® ¯® ¯ਪ®«ã ;LD HL,FILENAM ; ¨饬 䠩« ;CALL FENTRY:JP Z,ER2 ;LD HL,#1000,C,#02 ; ç¨⠥¬ 䠩« (1 ¡«®ª, 512 ¡ ©â) ;LD B,1:CALL LOAD512 DDR LD HL,DIR1 CALL FENTRY:JR NZ,DIIIR LD HL,DIR1+1:CALL MKDIR:JR Z,DDR JP ER3 DIIIR CALL SETDIR ; Set DIR found by FENTRY active ;Create File (flag,size,name,0): LD HL,FILE CALL MKFILE:JP NZ,ER4 ;Save data into new file: LD C,#00; Page LD HL,#0000;Offset LD B,8; Size (8blocks=4kb) CALL SAVE512 ;--------------------------------------- EXIT ;LD BC,#11AF,A,#05:OUT A LD BC,PE0,A,%00000001:OUT A LD BC,#10AF,A,0:OUT A ;LD BC,#12AF,A,#0F:OUT A RET ;--------------------------------------- VYGREB LD DE,#8000 VYG CALL NXTETY:RET Z LD A,D:CP #C0:RET NC JR VYG ;--------------------------------------- ER0 ;Device not found ; (SD Card NOT ready!) LD A,1:OUT (254) .10 HALT JP EXIT ;------- ER1 ;FAT32 NOT FOUND LD A,2:OUT (254) .10 HALT JP EXIT ;------- ER2 ;File NOT FOUND LD A,3:OUT (254) .10 HALT JP EXIT ;------- ER3 ;Dir Creation Failed LD A,4:OUT (254) .10 HALT JP EXIT ;------- ER4 ;File Creation Failed LD A,5:OUT (254) .10 HALT JP EXIT ;--------------------------------------- I_N_T EI RET ;--------------------------------------- FILENAM DB #00; #00 - file, #10 - DIR DB "WC_History.txt",0 FILE DB #00; flag DW #1000,#0000;length DB "�¥¥¡ ææ® ¤«¨­­®¥ ¨¬ï.txt",0 DIR1 DB #10 DB "DOWNLOAD",0 DIR2 DB #10 DB "ZIFI",0 ;--------------------------------------- CORE EQU #2002 DEV_INI EQU CORE+3 HDD EQU CORE+9 ;------- ;i: CHL - Addres ; B - lenght (512b blocks) ;o: CHL - New Value ; A - EndOfChain (#0F) LOAD512 EQU CORE+21 ;i: CHL - Addres ; B - lenght ;o: CHL - New Value ; A - EndOfChain (#0F) SAVE512 EQU CORE+24 DOS_SWP EQU CORE+27 ;i: HL - flag(1),ln(4),name(1-255),0 ; NZ - ERROR (NO ENOUGHT SPACE) ; A: 1 - ln not valid ; 2 - index fatality ; 3 - ln already exists ; 255 - unknown error ; Z - SUCCESS MKFILE EQU CORE+57 ;i: HL - DirName(1-255,0) ;o: NZ - ERROR ; A: 1 - ln not valid ; 2 - index fatality ; 3 - ln already exists ; 255 - unknown error ; Z - SUCCESS MKDIR EQU CORE+60 ;i: HL - flag(1),name(1-255),0 ;o: Z - NOT FOUND ; NZ - FILE DELETED DELFL EQU CORE+63 ;i: HL - flag(1),oldname(1-255),0 ; DE - newname(1-255),0 ;o: Z - NOT FOUND ; NZ - SUCCESS RENAM EQU CORE+66 ;Search for entry in current DIR ;i: HL - flag(1),name(1-255),0 ;o: Z - NOT FOUND ; NZ - [DE,HL] - file length ; SEEK0 is automatically called FENTRY EQU CORE+78 ;Seek/Skip N sectors ;i: B - Number of sectors to process LOADNON EQU CORE+84 ;GetNextEntryFromActiveDir ;i: DE - Addres ;o: DE - New Value ; Z - EndOfDir ; NZ - OK ; ;STRUCTURE: ;fclus(4),size(4),date(2),time(2), ;!flag(1),name(1-255),#00 NXTETY EQU CORE+87 ;Set DIR found by ENTRY active SETDIR EQU CORE+93 ;Set ROOT DIR active SETROOT EQU CORE+96 SEEK0 EQU CORE+99 ;------- VAGA INCB "WDFCVBI" VAGAE ;--------------------------------------- \ No newline at end of file diff --git a/_sd/WDFCVBI2.COD b/_sd/WDFCVBI2.COD new file mode 100644 index 0000000..3e776f1 Binary files /dev/null and b/_sd/WDFCVBI2.COD differ diff --git a/_sheme/AMS1117.png b/_sheme/AMS1117.png new file mode 100644 index 0000000..761f602 Binary files /dev/null and b/_sheme/AMS1117.png differ diff --git a/_sheme/Amixgris.jpg b/_sheme/Amixgris.jpg new file mode 100644 index 0000000..617f2a3 Binary files /dev/null and b/_sheme/Amixgris.jpg differ diff --git a/_sheme/ESP8266_V091.png b/_sheme/ESP8266_V091.png new file mode 100644 index 0000000..f98d9b5 Binary files /dev/null and b/_sheme/ESP8266_V091.png differ diff --git a/_sheme/djspavn.jpg b/_sheme/djspavn.jpg new file mode 100644 index 0000000..dc8ecbe Binary files /dev/null and b/_sheme/djspavn.jpg differ diff --git a/_sheme/esptool.7z b/_sheme/esptool.7z new file mode 100644 index 0000000..bb3e1bd Binary files /dev/null and b/_sheme/esptool.7z differ diff --git a/_sheme/kowalski.JPG b/_sheme/kowalski.JPG new file mode 100644 index 0000000..084e2c2 Binary files /dev/null and b/_sheme/kowalski.JPG differ diff --git a/_sheme/vbi.jpg b/_sheme/vbi.jpg new file mode 100644 index 0000000..7846c41 Binary files /dev/null and b/_sheme/vbi.jpg differ diff --git a/_sheme/zifi.7z b/_sheme/zifi.7z new file mode 100644 index 0000000..ff4f496 Binary files /dev/null and b/_sheme/zifi.7z differ diff --git a/_spg/.gitignore b/_spg/.gitignore new file mode 100644 index 0000000..ad14c08 --- /dev/null +++ b/_spg/.gitignore @@ -0,0 +1,5 @@ +zifi.l +zifi_rs.bin +zifi.bin +zifi.spg +zifi_rs.spg \ No newline at end of file diff --git a/_spg/WDFCVBI.COD b/_spg/WDFCVBI.COD new file mode 100644 index 0000000..889e7c9 Binary files /dev/null and b/_spg/WDFCVBI.COD differ diff --git a/_spg/WDFCVBI2.COD b/_spg/WDFCVBI2.COD new file mode 100644 index 0000000..6511901 Binary files /dev/null and b/_spg/WDFCVBI2.COD differ diff --git a/_spg/X.tga.pix b/_spg/X.tga.pix new file mode 100644 index 0000000..db39290 Binary files /dev/null and b/_spg/X.tga.pix differ diff --git a/_spg/ZIFI/zifi.ini b/_spg/ZIFI/zifi.ini new file mode 100644 index 0000000..7c85302 --- /dev/null +++ b/_spg/ZIFI/zifi.ini @@ -0,0 +1,3 @@ +SSID: YV +password: 1234123412 +time: none ; none, +x/x/-x diff --git a/_spg/_build.bat b/_spg/_build.bat new file mode 100644 index 0000000..00a46fb --- /dev/null +++ b/_spg/_build.bat @@ -0,0 +1,23 @@ +@echo off +cd /d "%~dp0" +spgbld.exe -b spgbld.ini zifi.spg +rem spgbld.exe -b spgbld_rs.ini zifi_rs.spg + + +mkdir ZIFI +del /s /q ZIFI\*.* +rem xcopy /Y zifi_rs.spg ZIFI\ +C:\Windows\System32\xcopy.exe /Y zifi.spg ZIFI\ +C:\Windows\System32\xcopy.exe /Y zifi.ini ZIFI\ + +rem SET IName="H:\speccy\_Emul\UnrealEvo_zifi\wc.img" + +rem robimg.exe -p=%IName% -a=1 -f=1 -o=2048 -s=262144 +rem robimg.exe -p=%IName% -a=1 -f=1 -s=131072 + +rem robimg.exe -p=%IName% -M="Test\InOne\InTwo\InThre1" +rem robimg.exe -p=%IName% -C="ZIFI",\ZIFI + +rem del /s /q ZIFI\*.* +rem rmdir /s /q "ZIFI" +pause \ No newline at end of file diff --git a/_spg/_build_all.sh b/_spg/_build_all.sh new file mode 100644 index 0000000..301e663 --- /dev/null +++ b/_spg/_build_all.sh @@ -0,0 +1,14 @@ +#!/bin/sh +cp ../zifi.asm zifi.asm +cp zifi.asm zifi_rs.asm +sed -i 's/cable_zifi=0/cable_zifi=1/g' zifi_rs.asm +cd .. +wine sjasmplus _spg/zifi.asm +wine sjasmplus _spg/zifi_rs.asm +cd _spg +wine spgbld.exe -b spgbld.ini zifi.spg +wine spgbld.exe -b spgbld_rs.ini zifi_rs.spg +cp zifi.spg ../_Current_version_executable/zifi.spg +cp zifi_rs.spg ../_Current_version_executable/zifi_rs.spg +rm -rf zifi.asm +rm -rf zifi_rs.asm diff --git a/_spg/cursor.tga.pal b/_spg/cursor.tga.pal new file mode 100644 index 0000000..37cbeb6 Binary files /dev/null and b/_spg/cursor.tga.pal differ diff --git a/_spg/cursor.tga.pix4 b/_spg/cursor.tga.pix4 new file mode 100644 index 0000000..a9f05c1 Binary files /dev/null and b/_spg/cursor.tga.pix4 differ diff --git a/_spg/disk.tga.pix b/_spg/disk.tga.pix new file mode 100644 index 0000000..4165949 Binary files /dev/null and b/_spg/disk.tga.pix differ diff --git a/_spg/download.tga.pix b/_spg/download.tga.pix new file mode 100644 index 0000000..ab8c0fd Binary files /dev/null and b/_spg/download.tga.pix differ diff --git a/_spg/fonts/cp1251-8x8 b/_spg/fonts/cp1251-8x8 new file mode 100644 index 0000000..0a5b778 Binary files /dev/null and b/_spg/fonts/cp1251-8x8 differ diff --git a/_spg/fonts/cp1251-8x8.png b/_spg/fonts/cp1251-8x8.png new file mode 100644 index 0000000..cef3e57 Binary files /dev/null and b/_spg/fonts/cp1251-8x8.png differ diff --git a/_spg/fonts/cp1251-8x8.tga b/_spg/fonts/cp1251-8x8.tga new file mode 100644 index 0000000..bd7162b Binary files /dev/null and b/_spg/fonts/cp1251-8x8.tga differ diff --git a/_spg/fonts/cp1251-8x8.tga.pal b/_spg/fonts/cp1251-8x8.tga.pal new file mode 100644 index 0000000..8f1053d Binary files /dev/null and b/_spg/fonts/cp1251-8x8.tga.pal differ diff --git a/_spg/fonts/cp1251-8x8.tga.pix4 b/_spg/fonts/cp1251-8x8.tga.pix4 new file mode 100644 index 0000000..c6e2334 Binary files /dev/null and b/_spg/fonts/cp1251-8x8.tga.pix4 differ diff --git a/_spg/fonts/cp866-8x8 b/_spg/fonts/cp866-8x8 new file mode 100644 index 0000000..e274ec2 Binary files /dev/null and b/_spg/fonts/cp866-8x8 differ diff --git a/_spg/fonts/font_6x8.$C.bin b/_spg/fonts/font_6x8.$C.bin new file mode 100644 index 0000000..85b5ada Binary files /dev/null and b/_spg/fonts/font_6x8.$C.bin differ diff --git a/_spg/fonts/geebeeyay-8x8.tga b/_spg/fonts/geebeeyay-8x8.tga new file mode 100644 index 0000000..96dd0fe Binary files /dev/null and b/_spg/fonts/geebeeyay-8x8.tga differ diff --git a/_spg/fonts/geebeeyay-8x8.tga.pal b/_spg/fonts/geebeeyay-8x8.tga.pal new file mode 100644 index 0000000..8ea0331 Binary files /dev/null and b/_spg/fonts/geebeeyay-8x8.tga.pal differ diff --git a/_spg/fonts/geebeeyay-8x8.tga.pix4 b/_spg/fonts/geebeeyay-8x8.tga.pix4 new file mode 100644 index 0000000..79e4016 Binary files /dev/null and b/_spg/fonts/geebeeyay-8x8.tga.pix4 differ diff --git a/_spg/fonts/geebeeyay-8x81.tga b/_spg/fonts/geebeeyay-8x81.tga new file mode 100644 index 0000000..ac8e418 Binary files /dev/null and b/_spg/fonts/geebeeyay-8x81.tga differ diff --git a/_spg/fonts/rus32_f.$C.bin b/_spg/fonts/rus32_f.$C.bin new file mode 100644 index 0000000..890afe2 Binary files /dev/null and b/_spg/fonts/rus32_f.$C.bin differ diff --git a/_spg/hl.pix b/_spg/hl.pix new file mode 100644 index 0000000..b7a7f8d --- /dev/null +++ b/_spg/hl.pix @@ -0,0 +1 @@ +<<:<<9%4'3DAAAAAAD4%=)K[[[[[[[[E'4)R[[[[[[[^=)4+X[[[[[[[^<*4%797777779'%%':::4:::::%'%4[:<<<4!B^R'2DAAAAD4%UdU&K[[[[X^E%R^E'R[[[[X^=)X^A)X[[[[[^4*ad=!797779:'%9:%'<::::::%)A<%44&""""&/JR'2D4&"""$/F\*"(N/&//""*N*"$("*N^='*"*R&"*J[[^:*=*""""*7799%""&29'%&"""""$4 +Recv 4 bytes + +SEND OK + + +AT+CIPSEND=104 +GET /index.php HTTP/1.0 +Host: zxart.ee +User-Agent: ZiFi (ZX Evo) +Accept: */* +Connection: close + + diff --git a/_src/ESP8266 docs/espprob1.a80 b/_src/ESP8266 docs/espprob1.a80 new file mode 100644 index 0000000..f3044dd --- /dev/null +++ b/_src/ESP8266 docs/espprob1.a80 @@ -0,0 +1,706 @@ + relaxed on + cpu z80undoc + +bigbuff:equ 0x8000 + + org 0x6000 +;--------------------------------------- + res 4,(iy+1) + ld bc,0x7ffd + ld a,0x17 + out (c),a + ld a,0x07 + ld (0x5c48),a + ld (0x5c8d),a + xor a + out (0xfe),a + call zx_cls + ld hl,udg + ld (0x5c7b),hl + +p100: ld a,0x45 + ld (0x5c8f),a + ld hl,p100 + push hl + + ld hl,msg_baudmenu + call zx_puts_safe +p102: call zx_getkey + ld de,1 + cp 0x31 + jr z,p101 + inc e + cp 0x32 + jr z,p101 + inc e + cp 0x33 + jr z,p101 + inc e + cp 0x34 + jr z,p101 + ld e,6 + cp 0x35 + jr z,p101 + ld e,8 + cp 0x36 + jr z,p101 + ld e,12 + cp 0x37 + jr nz,p102 +p101: + call rs232_init + halt + ld b,3 +p103: push bc + ld de,25 + ld hl,cmd_ate0 + call send_cmd_wait_ok + pop bc + jr z,p104 + djnz p103 + jp x_err +p104: +; + ld hl,msg_req_vers + call zx_puts_safe + ld de,25 + ld hl,cmd_gmr + call send_cmd_wait_ok + jp nz,x_err +; + ld hl,msg_press_key + call zx_puts_safe + call zx_getkey +; + ld hl,msg_chg_baud + call zx_puts_safe + ld de,25 + ld hl,cmd_uart_9600 + call send_cmd_wait_ok + jp nz,x_err + ld de,12 + call rs232_init + halt +; + ld de,25 + ld hl,cmd_cwmode + call send_cmd_wait_ok + jp nz,x_err + ld de,25 + ld hl,cmd_cwautoconn + call send_cmd_wait_ok + jp nz,x_err + ld de,25 + ld hl,cmd_cwqap + call send_cmd_wait_ok + jp nz,x_err +; +p110: ld hl,msg_ap_list + call zx_puts_safe + ld de,250 + ld hl,cmd_cwlap + call send_cmd_wait_ok + jp nz,x_err + + ld hl,msg_repeat + call zx_puts_safe + call zx_getkey + cp 'R' + jr z,p110 + cp 'r' + jr z,p110 +; + ld hl,msg_ap_conn + call zx_puts_safe + ld de,1000 + ld hl,cmd_cwjap + call send_cmd_wait_ok + jp z,p120 + call x_err + jr p110 +; +p120: ld hl,msg_ipcfg + call zx_puts_safe + ld de,25 + ld hl,cmd_cipsta + call send_cmd_wait_ok + call nz,x_err +; + ld hl,msg_ping + call zx_puts_safe + ld de,75 + ld hl,cmd_ping_g + call send_cmd_wait_ok + call nz,x_err + ld de,75 + ld hl,cmd_ping_y + call send_cmd_wait_ok + call nz,x_err +; +p199: ld hl,msg_press_key + call zx_puts_safe + call zx_getkey +; +p200: ld hl,bigbuff + ld (ptr),hl + ld de,bigbuff+1 + ld bc,16384 + ld (hl),0 + ldir + call zx_cls + ld a,0x45 + ld (0x5c8f),a + ld hl,msg_menuload + call zx_puts_safe +p201: call zx_getkey + cp 0x31 + jr c,p201 + cp 0x3a + jr nc,p201 + sub 0x31 + ld (resnum),a + + call rs232_reset_fifo + ld hl,msg_open_tcp + call zx_puts_safe + ld de,250 + ld hl,cmd_conn2site + call send_cmd_wait_ok + jp z,p210 + call x_err + jr p199 +p210: + ld de,50 + call set_timeout50 + ld a,0x06 + ld (0x5c8f),a + ld hl,cmd_cipsend + call rs232_putstr + ld a,(resnum) + ld l,a + ld h,0 + add hl,hl + add hl,hl + ld de,tabl_ptrurl + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call rs232_putstr + ld hl,str_crlf + call rs232_putstr + + call wait_ok + jp z,p211 + call x_err + jp p199 +p211: ld a,0x07 + ld (0x5c8f),a +p212: call rs232_getchar + jr z,p212 + push af + call zx_putchar_safe + pop af + cp '>' + jr nz,p211 + + ld a,0x06 + ld (0x5c8f),a + ld hl,str_get1 + call rs232_putstr + ld a,(resnum) + ld l,a + ld h,0 + add hl,hl + inc hl + add hl,hl + ld de,tabl_ptrurl + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + ex de,hl + call rs232_putstr + ld hl,str_get2 + call rs232_putstr + + call wait_ok + cp 0xfd + jp z,p220 + call x_err + jp p199 + +p220: ld de,1000 + call set_timeout50 + +p22a: ld a,0x07 + ld (0x5c8f),a + ld hl,strbuff + ld (hl),0 + call rdipd + ld a,(strbuff) + or a + jr nz,p221 + call x_tout + jp p199 +p221: ld de,str_ipd + call ss_cmp + jr z,p222 + call x_err + jp p199 +p222: + ld a,0x45 + ld (0x5c8f),a + ld hl,msg_skip + call zx_puts_safe + ld hl,0 + ld de,strbuff+7 +p223: ld a,(de) + inc de + cp ':' + jr z,p230 + sub 0x30 + ld c,l + ld b,h + add hl,hl + add hl,hl + add hl,bc + add hl,hl + ld c,a + ld b,0 + add hl,bc + jr p223 + +p230: ld (packsz),hl + ex de,hl + ld hl,(ptr) +p231: call rs232_getchar + jr nz,p232 + call check_timeout + jr c,p231 + call x_tout + jp p199 +p232: ld (hl),a + inc hl + dec de + ld a,d + or e + jr nz,p231 + ld (ptr),hl + + ld hl,(packsz) + ld de,1360 + xor a + sbc hl,de + jr nc,p22a +; + ld hl,bigbuff +p241: ld a,(hl) + inc hl +p242: cp 10 + jr nz,p241 + ld a,(hl) + inc hl + cp 13 + jr nz,p242 + inc hl + + ld a,(resnum) + cp 3 + jp c,pscr0 + cp 6 + jp c,pgiga0 +;pmus0: + push hl + ex de,hl + ld hl,(ptr) + xor a + sbc hl,de + ld c,l + ld b,h + pop hl + ld de,0xc86e + ldir + ld hl,vtpl + ld de,0xc000 + ld bc,sz_vtpl + ldir + ld a,0x45 + ld (0x5c8f),a + ld hl,msg_musply + call zx_puts_safe + call 0xc000 + ei + res 5,(iy+1) +pmus1: halt + call 0xc005 + bit 5,(iy+1) + jr z,pmus1 + call 0xc008 + jp p200 +; +pgiga0: ld de,0x4000 + ld bc,0x1b00 + ldir + ld de,0xc000 + ld bc,0x1b00 + ldir + res 5,(iy+1) + ld bc,0x7ffd +pgiga1: halt + ld a,0x1f + out (c),a + halt + ld a,0x17 + out (c),a + bit 5,(iy+1) + jr z,pgiga1 + jp p200 +; +pscr0: ld de,0x4000 + ld bc,0x1b00 + ldir + call zx_getkey + jp p200 +;------------------------------ +x_err: ld hl,msgff_error + cp 1 + jr nz,x_er1 +x_tout: ld hl,msgff_timeout +x_er1: call zx_puts_ff + ret +;------------------------------ +send_cmd_wait_ok: + push hl + call set_timeout50 + call rs232_reset_fifo + ld a,0x06 + ld (0x5c8f),a + pop hl + call rs232_putstr + ld a,0x45 + ld (0x5c8f),a +wait_ok:ld hl,strbuff + call rdstr + ld a,(strbuff) + or a + jr nz,_scwo1 + inc a + ret +_scwo1: ld a,0x07 + ld (0x5c8f),a + ld hl,strbuff + call zx_puts_safe + ld a,0x45 + ld (0x5c8f),a + ld de,str_ok + call ss_cmp + ld a,0x00 + jr z,_scwo9 + ld de,str_fail + call ss_cmp + ld a,0xff + jr z,_scwo9 + ld de,str_error + call ss_cmp + ld a,0xfe + jr z,_scwo9 + ld de,str_send_ok + call ss_cmp + ld a,0xfd + jr nz,wait_ok +_scwo9: or a + ret +;------------------------------ +rdstr: call rs232_getchar + jr z,rdst2 + cp 10 ;LF + jr z,rdst3 + ld (hl),a + inc hl + jr rdstr +rdst2: call check_timeout + jr c,rdstr +rdst3: ld (hl),0 + ret +;------------------------------ +rdipd: call rs232_getchar + jr z,ripd2 + ld (hl),a + inc hl + push af + call zx_putchar_safe + pop af + cp ':' + ret z + jr rdipd +ripd2: call check_timeout + jr c,rdipd + ret +;------------------------------ +ss_cmp: ld hl,strbuff +ss_cm1: ld a,(de) + or a + ret z + inc de + cpi + jr z,ss_cm1 + ret +;------------------------------ +rs232_init: + ld bc,0xfbef ;LCR + ld a,0x83 + out (c),a + ld b,0xf8 ;DLL + out (c),e + inc b ;DLM + out (c),d + ld b,0xfc ;MCR + ld a,0x03 + out (c),a + dec b ;LCR + ld a,0x03 + out (c),a +rs232_reset_fifo: + ld bc,0xfaef ;FCR + ld a,0x07 ;FIFO reset + out (c),a + ld a,0x01 + out (c),A +_clfifo:ld b,0xfd ;LSR + in a,(c) + and 0x01 + ret z + ld b,0xf8 ;DAT + in a,(c) + jr _clfifo +;------------------------------ +rs232_putchar: + push AF + call zx_putchar_safe + pop de + ld bc,0xfdef ;LSR +_putch1:in a,(c) + and 0x20 + jr z,_putch1 + ld b,0xf8 ;DAT + out (c),d + ret +;------------------------------ +rs232_putstr: + ld a,(hl) + inc hl + or a + ret z + call rs232_putchar + jr rs232_putstr +;------------------------------ +rs232_getchar: + ld bc,0xfdef ;LSR + in a,(c) + and 0x01 + ret z + ld b,0xf8 ;DAT + in a,(c) + inc b + ret +;------------------------------ +zx_putchar_safe: + cp 10 ;LF + ret z + cp 13 ;CR + jr z,_putc1 + cp 0x20 + jr c,_putc2 + cp 0x80 + jr c,_putc1 +_putc2: ld a,0x90 +_putc1: push hl + rst 0x10 + pop hl + ret +;------------------------------ +zx_puts_safe: + ld a,0xff + ld (0x5c8c),a +_puts1: ld a,(hl) + inc hl + or a + ret z + call zx_putchar_safe + jr _puts1 +;------------------------------ +zx_puts_ff: + ld a,0xff + ld (0x5c8c),a +_psff1: ld a,(hl) + inc hl + cp 0xff + ret z + push hl + rst 0x10 + pop hl + jr _psff1 +;------------------------------ +zx_getkey: + res 5,(iy+1) +_getk1: bit 5,(iy+1) + jr z,_getk1 + ld a,(iy-50) + ret +;------------------------------ +zx_cls: ld a,2 + ld (0x5c6b),a + call 0x0d6b + ld a,2 + call 0x1601 + xor a + ld (0x5c6b),a + ret +;------------------------------ +set_timeout50: + ld hl,(0x5c78) + add hl,de + ld (tmout),hl + ret +;------------------------------ +check_timeout: + push hl + push de + ld de,(tmout) + ld hl,(0x5c78) + xor a + sbc hl,de + pop de + pop hl + ret +;------------------------------ +tmout: defw 0 +ptr: defw 0 +packsz: defw 0 +resnum: defb 0 +;------------------------------ +udg: defb 0b00000000 + defb 0b01010100 + defb 0b00101010 + defb 0b01010100 + defb 0b00101010 + defb 0b01010100 + defb 0b00101010 + defb 0b00000000 +;------------------------------ +vtpl: + listing off + include "vtplayer.inc" + listing on +sz_vtpl:equ $-vtpl +;------------------------------ +tabl_ptrurl: + defw str_rqsz1,str_uri1 + defw str_rqsz2,str_uri2 + defw str_rqsz3,str_uri3 + defw str_rqsz4,str_uri4 + defw str_rqsz5,str_uri5 + defw str_rqsz6,str_uri6 + defw str_rqsz7,str_uri7 + defw str_rqsz8,str_uri8 + defw str_rqsz9,str_uri9 +;------------------------------ +msgff_timeout: defb 19,1,13,16,2,"- Timeout! -",16,5,13,0xff +msgff_error: defb 19,1,13,16,2,"- Error! -",16,5,13,0xff + +msg_baudmenu: defb "Select baudrate:",13 + defb "1.115200",13 + defb "2. 57600",13 + defb "3. 38400",13 + defb "4. 28800",13 + defb "5. 19200",13 + defb "6. 14400",13 + defb "7. 9600",13,0 +msg_req_vers: defb "Firmware version...",13,0 +msg_press_key: defb "Press a key",13,0 +msg_chg_baud: defb "Change baudrate...",13,0 +msg_ap_list: defb "AccessPoint list...",13,0 +msg_repeat: defb "R - repeat, else continue",13,0 +msg_ap_conn: defb "Connect to AccessPoint...",13,0 +msg_ipcfg: defb "IP config info...",13,0 +msg_ping: defb "Ping...",13,0 +msg_menuload: defb "Now, we can try to load some",13 + defb "pre-defined resources",13 + defb "from the Internet.",13 + defb "1. scr #1",13 + defb "2. scr #2",13 + defb "3. scr #3",13 + defb "4. gigascr #1",13 + defb "5. gigascr #2",13 + defb "6. gigascr #3",13 + defb "7. pt3 #1",13 + defb "8. pt3 #2",13 + defb "9. pt3 #3",13,0 +msg_open_tcp: defb "Open TCP connection...",13,0 +msg_musply: defb 13,"PT3-module playing" +msg_skip: defb "...",0 + +cmd_ate0: defb "ATE0" +str_crlf: defb 13,10,0 +cmd_gmr: defb "AT+GMR",13,10,0 +cmd_uart_9600: defb "AT+UART_CUR=9600,8,1,0,0",13,10,0 +cmd_cwmode: defb "AT+CWMODE_DEF=1",13,10,0 +cmd_cwautoconn: defb "AT+CWAUTOCONN=0",13,10,0 +cmd_cwqap: defb "AT+CWQAP",13,10,0 +cmd_cwlap: defb "AT+CWLAP",13,10,0 +cmd_cwjap: defb "AT+CWJAP_CUR=",0x22 + defb "wifitest123" ; SSID + defb 0x22,0x2c,0x22 + defb "ZXSpectrumForeverHelloEverybody321" ; password + defb 0x22,13,10,0 +cmd_cipsta: defb "AT+CIPSTA?",13,10,0 +cmd_ping_g: defb "AT+PING=",0x22,"google.com",0x22,13,10,0 +cmd_ping_y: defb "AT+PING=",0x22,"yandex.ru",0x22,13,10,0 +cmd_conn2site: defb "AT+CIPSTART=",0x22,"TCP",0x22,",",0x22 + defb "zxart.ee" ; site + defb 0x22,",80",13,10,0 +cmd_cipsend: defb "AT+CIPSEND=",0 + +str_get1: defb "GET ",0 ;size=4 +str_get2: defb " HTTP/1.1",13,10 ;size=123 + defb "Host: zxart.ee",13,10 + defb "User-Agent: ESP8266-probe1 (ZX Spectrum; CPU Z80; RAM 128Kb)",13,10 ; show off ;) + defb "Accept: */*",13,10 + defb "Connection: close",13,10,13,10,0 + +str_uri1: defb "/file/id:61049/filename:%D0%9A%D0%90%D0%A1%D0%B8%D0%BA_-_Banka_%282015%29_%283BM_OpenAir_2015%2C_3%29.scr",0 ;size=105 +str_rqsz1: defb "232",0 ;232=4+105+123=get1+uri1+get2 + +str_uri2: defb "/file/id:61053/filename:Buddy_-_Drunk_Kung-Fu_%282015%29_%283BM_OpenAir_2015%2C_5%29.scr",0 ;size=88 +str_rqsz2: defb "215",0 ;215=4+88+123=get1+uri2+get2 + +str_uri3: defb "/file/id:61058/filename:brightentayle_-_The_Split_Foundations_%282015%29_%283BM_OpenAir_2015%2C_6%29.scr",0 ;size=104 +str_rqsz3: defb "231",0 ;231=4+104+123=get1+uri3+get2 + +str_uri4: defb "/file/id:61060/filename:Tutty_-_Bat2Con_%282015%29_%283BM_OpenAir_2015%2C_1%29.img",0 ;size=82 +str_rqsz4: defb "209",0 ;209=4+82+123=get1+uri4+get2 + +str_uri5: defb "/file/id:61059/filename:Dimidrol_-_Amur_tiger_%282015%29_%283BM_OpenAir_2015%2C_2%29.img",0 ;size=88 +str_rqsz5: defb "215",0 ;215=4+88+123=get1+uri5+get2 + +str_uri6: defb "/file/id:61061/filename:prof4d_-_Fructus_%282015%29_%283BM_OpenAir_2015%2C_4%29.img",0 ;size=83 +str_rqsz6: defb "210",0 ;210=4+83+123=get1+uri6+get2 + +str_uri7: defb "/file/id:61065/filename:luchibobra_-_three_bad_mice_%282015%29_%283BM_OpenAir_2015%2C_1%29.pt3",0 ;size=94 +str_rqsz7: defb "221",0 ;221=4+94+123=get1+uri7+get2 + +str_uri8: defb "/file/id:61067/filename:MmcM_-_summertime_%282015%29_%283BM_OpenAir_2015%2C_2%29.pt3",0 ;size=84 +str_rqsz8: defb "211",0 ;211=4+84+123=get1+uri8+get2 + +str_uri9: defb "/file/id:61066/filename:wbc_-_isglass-3_%282015%29_%283BM_OpenAir_2015%2C_3%29.pt3",0 ;size=82 +str_rqsz9: defb "209",0 ;209=4+82+123=get1+uri9+get2 + +str_ok: defb "OK",13,0 +str_error: defb "ERROR",13,0 +str_fail: defb "FAIL",13,0 +str_send_ok: defb "SEND OK",13,0 +str_ipd: defb 13,10,"+IPD,",0 +strbuff: +;------------------------------ diff --git a/_src/ESP8266 docs/irc.c b/_src/ESP8266 docs/irc.c new file mode 100644 index 0000000..6e7cfc3 --- /dev/null +++ b/_src/ESP8266 docs/irc.c @@ -0,0 +1,94 @@ +#include +#include +#include +#include + +int conn; +char sbuf[512]; + +void raw(char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + vsnprintf(sbuf, 512, fmt, ap); + va_end(ap); + printf("<< %s", sbuf); + write(conn, sbuf, strlen(sbuf)); +} + +int main() { + + char *nick = "test"; + char *channel = NULL; + char *host = "irc.dav7.net"; + char *port = "6667"; + + char *user, *command, *where, *message, *sep, *target; + int i, j, l, sl, o = -1, start, wordcount; + char buf[513]; + struct addrinfo hints, *res; + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + getaddrinfo(host, port, &hints, &res); + conn = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + connect(conn, res->ai_addr, res->ai_addrlen); + + raw("USER %s 0 0 :%s\r\n", nick, nick); + raw("NICK %s\r\n", nick); + + while ((sl = read(conn, sbuf, 512))) { + for (i = 0; i < sl; i++) { + o++; + buf[o] = sbuf[i]; + if ((i > 0 && sbuf[i] == '\n' && sbuf[i - 1] == '\r') || o == 512) { + buf[o + 1] = '\0'; + l = o; + o = -1; + + printf(">> %s", buf); + + if (!strncmp(buf, "PING", 4)) { + buf[1] = 'O'; + raw(buf); + } else if (buf[0] == ':') { + wordcount = 0; + user = command = where = message = NULL; + for (j = 1; j < l; j++) { + if (buf[j] == ' ') { + buf[j] = '\0'; + wordcount++; + switch(wordcount) { + case 1: user = buf + 1; break; + case 2: command = buf + start; break; + case 3: where = buf + start; break; + } + if (j == l - 1) continue; + start = j + 1; + } else if (buf[j] == ':' && wordcount == 3) { + if (j < l - 1) message = buf + j + 1; + break; + } + } + + if (wordcount < 2) continue; + + if (!strncmp(command, "001", 3) && channel != NULL) { + raw("JOIN %s\r\n", channel); + } else if (!strncmp(command, "PRIVMSG", 7) || !strncmp(command, "NOTICE", 6)) { + if (where == NULL || message == NULL) continue; + if ((sep = strchr(user, '!')) != NULL) user[sep - user] = '\0'; + if (where[0] == '#' || where[0] == '&' || where[0] == '+' || where[0] == '!') target = where; else target = user; + printf("[from: %s] [reply-with: %s] [where: %s] [reply-to: %s] %s", user, command, where, target, message); + //raw("%s %s :%s", command, target, message); // If you enable this the IRCd will get its "*** Looking up your hostname..." messages thrown back at it but it works... + } + } + + } + } + + } + + return 0; + +} \ No newline at end of file diff --git a/_src/ESP8266 docs/irc.rar b/_src/ESP8266 docs/irc.rar new file mode 100644 index 0000000..96ea289 Binary files /dev/null and b/_src/ESP8266 docs/irc.rar differ diff --git a/_src/ESP8266 docs/irc_.c b/_src/ESP8266 docs/irc_.c new file mode 100644 index 0000000..d01a290 --- /dev/null +++ b/_src/ESP8266 docs/irc_.c @@ -0,0 +1,646 @@ +/*% cc -g -Wall -lncurses -o # % + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SCROLL 15 +#define INDENT 21 +#define DATEFMT "%H:%M" +#define PFMT "%-12s < %s" +#define SRV "irc.oftc.net" +#define PORT 6667 + +enum { ChanLen = 64, LineLen = 512, MaxChans = 16, BufSz = 2048, LogSz = 4096 }; + +char nick[64]; +int quit, winchg; +int sfd; /* Server file descriptor. */ +struct { + int x; + int y; + WINDOW *sw, *mw, *iw; +} scr; /* Screen relative data. */ +struct Chan { + char name[ChanLen]; + char *buf, *eol; + int n; /* Scroll offset. */ + size_t sz; /* size of buf. */ +} chl[MaxChans]; +int nch, ch; /* Current number of channels, and current channel. */ +char outb[BufSz], *outp=outb; /* Output buffer. */ + +static void scmd(char *, char *, char *, char *); +static void tdrawbar(void); +static void tredraw(void); +static void treset(void); + +static void +panic(const char *m) +{ + treset(); + fprintf(stderr, "Panic: %s\n", m); + exit(1); +} + +static void +sndf(const char *fmt, ...) +{ + va_list vl; + size_t n, l=BufSz-(outp-outb); + + if (l<2) return; + va_start(vl, fmt); + n=vsnprintf(outp, l-2, fmt, vl); + va_end(vl); + outp += n>l-2 ? l-2 : n; + *outp++ = '\r'; + *outp++ = '\n'; +} + +static int +srd(void) +{ + static char l[BufSz], *p=l; + char *s, *usr, *cmd, *par, *data; + int rd; + + if (p-l>=BufSz) p=l; /* Input buffer overflow, there should something better to do. */ + rd=read(sfd, p, BufSz-(p-l)); + if (rd<0) { + if (errno==EINTR) return 1; + panic("IO error while reading."); + } + if (rd==0) return 0; + p+=rd; + for (;;) { /* Cycle on all received lines. */ + if (!(s=memchr(l, '\n', p-l))) + return 1; + if (s>l && s[-1]=='\r') + s[-1]=0; + *s++ = 0; + if (*l==':') { + if (!(cmd=strchr(l, ' '))) goto lskip; + *cmd++ = 0; + usr = l+1; + } else { + usr = 0; + cmd = l; + } + if (!(par=strchr(cmd, ' '))) goto lskip; + *par++ = 0; + if ((data=strchr(par, ':'))) + *data++ = 0; + scmd(usr, cmd, par, data); + lskip: + memmove(l, s, p-s); + p-=s-l; + } +} + +static int +dial(const char *host, short port) +{ + int f; + struct sockaddr_in sin; + struct addrinfo *ai, hai = { 0 }; + + hai.ai_family = AF_INET; + hai.ai_socktype = SOCK_STREAM; + if (getaddrinfo(host, 0, &hai, &ai)) + panic("Cannot resolve host."); + memcpy(&sin, ai->ai_addr, sizeof sin); + sin.sin_port = htons(port); + freeaddrinfo(ai); + f = socket(AF_INET, SOCK_STREAM, 0); + if (f<0) + panic("Cannot create socket."); + if (connect(f, (struct sockaddr *)&sin, sizeof sin)<0) + panic("Cannot connect to host."); + return f; +} + +static int +chadd(char *name) +{ + if (nch>=MaxChans || strlen(name)>=ChanLen) + return -1; + strcpy(chl[nch].name, name); + chl[nch].sz=LogSz; + chl[nch].buf=malloc(LogSz); + if (!chl[nch].buf) + panic("Out of memory."); + chl[nch].eol=chl[nch].buf; + chl[nch].n=0; + ch=nch++; + tdrawbar(); + return nch; +} + +static inline int +chfind(char *name) +{ + int i; + + assert(name); + for (i=nch-1; i>0; i--) + if (!strcmp(chl[i].name, name)) + break; + return i; +} + +static int +chdel(char *name) +{ + int n; + + if (!(n=chfind(name))) return 0; + nch--; + free(chl[n].buf); + memmove(&chl[n], &chl[n+1], (nch-n)*sizeof(struct Chan)); + ch=nch-1; + tdrawbar(); + return 1; +} + +static char * +pushl(char *p, char *e) +{ + int x=0; + char *w; + + if ((w=memchr(p, '\n', e-p))) e=w+1; + for (w=p;;) { + if (p>=e || *p==' ' || p-w+INDENT>=scr.x-1) { + for (; w=e) return e; + } + p++; + if (++x>=scr.x) { + waddch(scr.mw, '\n'); + for (x=0; xeol-c->buf; + va_list vl; + time_t t; + struct tm *tm; + + if (blen+LineLen>=c->sz) { + c->sz *= 2; + c->buf=realloc(c->buf, c->sz); + if (!c->buf) panic("Out of memory."); + c->eol=c->buf+blen; + } + t=time(0); + if (!(tm=localtime(&t))) panic("Localtime failed."); + n=strftime(c->eol, LineLen, DATEFMT, tm); + c->eol[n++] = ' '; + va_start(vl, fmt); + n+=vsnprintf(c->eol+n, LineLen-n-1, fmt, vl); + va_end(vl); + strcat(c->eol, "\n"); + if (n>=LineLen-1) + c->eol+=LineLen-1; + else + c->eol+=n+1; + if (cn==ch && c->n==0) { + char *p=c->eol-n-1; + if (p!=c->buf) waddch(scr.mw, '\n'); + pushl(p, c->eol-1); + wrefresh(scr.mw); + } +} + +static void +scmd(char *usr, char *cmd, char *par, char *data) +{ + int s; + char *pm=strtok(par, " "); + + if (!usr) usr="?"; + else { + char *bang=strchr(usr, '!'); + if (bang) + *bang=0; + } + if (!strcmp(cmd, "PRIVMSG")) { + if (!pm || !data) return; + pushf(chfind(pm), PFMT, usr, data); + } else if (!strcmp(cmd, "PING")) { + sndf("PONG :%s", data?data:"(null)"); + } else if (!strcmp(cmd, "PART")) { + if (!pm) return; + pushf(chfind(pm), "-!- %s has left %s", usr, pm); + } else if (!strcmp(cmd, "JOIN")) { + if (!pm) return; + pushf(chfind(pm), "-!- %s has joined %s", usr, pm); + } else if (!strcmp(cmd, "470")) { /* Channel forwarding. */ + char *ch=strtok(0, " "), *fch=strtok(0, " "); + if (!ch || !fch || !(s=chfind(ch))) return; + chl[s].name[0] = 0; + strncat(chl[s].name, fch, ChanLen-1); + tdrawbar(); + } else if (!strcmp(cmd, "471") || !strcmp(cmd, "473") + || !strcmp(cmd, "474") || !strcmp(cmd, "475")) { /* Join error. */ + if ((pm=strtok(0, " "))) { + chdel(pm); + pushf(0, "-!- Cannot join channel %s (%s)", pm, cmd); + tredraw(); + } + } else if (!strcmp(cmd, "QUIT")) { /* Commands we don't care about. */ + return; + } else if (!strcmp(cmd, "NOTICE") || !strcmp(cmd, "375") + || !strcmp(cmd, "372") || !strcmp(cmd, "376")) { + pushf(0, "%s", data?data:""); + } else + pushf(0, "%s - %s %s", cmd, par, data?data:"(null)"); +} + +static void +uparse(char *m) +{ + char *p=m; + + if (!p[0] || (p[1]!=' ' && p[1]!=0)) { + pmsg: + if (ch==0) return; + m+=strspn(m, " "); + if (!*m) return; + pushf(ch, PFMT, nick, m); + sndf("PRIVMSG %s :%s", chl[ch].name, m); + return; + } + switch (*p) { + case 'j': /* Join channels. */ + p+=1+(p[1]==' '); + p=strtok(p, " "); + while (p) { + if (chadd(p)<0) break; + sndf("JOIN %s", p); + p=strtok(0, " "); + } + tredraw(); + return; + case 'l': /* Leave channels. */ + p+=1+(p[1]==' '); + if (!*p) { + if (ch==0) return; /* Cannot leave server window. */ + strcat(p, chl[ch].name); + } + p=strtok(p, " "); + while (p) { + if (chdel(p)) + sndf("PART %s", p); + p=strtok(0, " "); + } + tredraw(); + return; + case 'm': /* Private message. */ + m=p+1+(p[1]==' '); + if (!(p=strchr(m, ' '))) return; + *p++ = 0; + sndf("PRIVMSG %s :%s", m, p); + return; + case 'r': /* Send raw. */ + if (p[1]) + sndf("%s", &p[2]); + return; + case 'q': /* Quit. */ + quit=1; + return; + default: /* Send on current channel. */ + goto pmsg; + } +} + +static void +sigwinch(int sig) +{ + if (sig) winchg=1; +} + +static void +tinit(void) +{ + setlocale(LC_ALL, ""); + signal(SIGWINCH, sigwinch); + initscr(); + raw(); + noecho(); + getmaxyx(stdscr, scr.y, scr.x); + if (scr.y<4) panic("Screen too small."); + if ((scr.sw=newwin(1, scr.x, 0, 0))==0 + || (scr.mw=newwin(scr.y-2, scr.x, 1, 0))==0 + || (scr.iw=newwin(1, scr.x, scr.y-1, 0))==0) + panic("Cannot create windows."); + keypad(scr.iw, 1); + scrollok(scr.mw, 1); + if (has_colors()==TRUE) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + wbkgd(scr.sw, COLOR_PAIR(1)); + } +} + +static void +tresize(void) +{ + struct winsize ws; + + winchg=0; + if (ioctl(0, TIOCGWINSZ, &ws)<0) + panic("Ioctl (TIOCGWINSZ) failed."); + resizeterm(scr.y=ws.ws_row, scr.x=ws.ws_col); + if (scr.y<3 || scr.x<10) + panic("Screen too small."); + wresize(scr.mw, scr.y-2, scr.x); + wresize(scr.iw, 1, scr.x); + wresize(scr.sw, 1, scr.x); + mvwin(scr.iw, scr.y-1, 0); + tredraw(); + tdrawbar(); +} + +static void +tredraw(void) +{ + struct Chan *const c=&chl[ch]; + char *q, *p; + int llen=0, nl=-1; + + if (c->eol==c->buf) { + wclear(scr.mw); + wrefresh(scr.mw); + return; + } + p=c->eol-1; + if (c->n) { + int i=c->n; + for (; p>c->buf; p--) + if (*p=='\n' && !i--) break; + if (p==c->buf) c->n-=i; + } + q=p; + while (nlc->buf) + q--, llen++; + nl += 1+llen/scr.x; + if (q==c->buf) break; + q--; + } + if (q!=c->buf) q+=2; + for (llen=0; nl>scr.y-2; ) { /* Maybe we must split the top line. */ + if (q[llen]=='\n' || llen>=scr.x) { + q+=llen+(q[llen]=='\n'); + llen=0; + nl--; + } else llen++; + } + wclear(scr.mw); + wmove(scr.mw, 0, 0); + while (q0 && l=len) return; + memmove(&l[cu], &l[cu+1], len-cu-1); + dirty=cu; + len--; + break; + case KEY_BACKSPACE: + if (cu==0) return; + memmove(&l[cu-1], &l[cu], len-cu); + dirty=--cu; + len--; + break; + case '\n': + l[len]=0; + uparse(l); + dirty=cu=len=0; + break; + default: + if (c>CHAR_MAX || len>=BufSz-1) return; /* Skip other curses codes. */ + memmove(&l[cu+1], &l[cu], len-cu); + dirty=cu; + len++; + l[cu++]=c; + break; + } + while (cu=scr.x/2 ? scr.x/2 : shft; + while (cu>=scr.x+shft) + dirty=0, shft += scr.x/2; + if (dirty<=shft) + i=shft; + else if (dirty>scr.x+shft || dirty>len) + goto mvcur; + else + i=dirty; + wmove(scr.iw, 0, i-shft); + wclrtoeol(scr.iw); + for (; i-shft=0) + switch (o) { + case 'h': + case '?': + usage: + fputs("Usage: irc [-n NICK] [-u USER] [-s SERVER] [-p PORT] [-h]\n", stderr); + exit(0); + case 'n': + if (strlen(optarg)>=sizeof nick) goto usage; + strcpy(nick, optarg); + break; + case 'u': + user = optarg; + break; + case 's': + server = optarg; + break; + case 'p': + if (!(port=strtol(optarg, 0, 0))) goto usage; + break; + } + if (!nick[0] && ircnick && strlen(ircnick), + and list of parameters matched either by or + components. + + The BNF representation for this is: + + + ::= [':' ] + ::= | [ '!' ] [ '@' ] + ::= { } | + ::= ' ' { ' ' } + ::= [ ':' | ] + + ::= + ::= + + ::= CR LF + + + +Oikarinen & Reed [Page 8] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +NOTES: + + 1) is consists only of SPACE character(s) (0x20). + Specially notice that TABULATION, and all other control + characters are considered NON-WHITE-SPACE. + + 2) After extracting the parameter list, all parameters are equal, + whether matched by or . is just + a syntactic trick to allow SPACE within parameter. + + 3) The fact that CR and LF cannot appear in parameter strings is + just artifact of the message framing. This might change later. + + 4) The NUL character is not special in message framing, and + basically could end up inside a parameter, but as it would + cause extra complexities in normal C string handling. Therefore + NUL is not allowed within messages. + + 5) The last parameter may be an empty string. + + 6) Use of the extended prefix (['!' ] ['@' ]) must + not be used in server to server communications and is only + intended for server to client messages in order to provide + clients with more useful information about who a message is + from without the need for additional queries. + + Most protocol messages specify additional semantics and syntax for + the extracted parameter strings dictated by their position in the + list. For example, many server commands will assume that the first + parameter after the command is the list of targets, which can be + described with: + + ::= [ "," ] + ::= | '@' | | + ::= ('#' | '&') + ::= + ::= see RFC 952 [DNS:4] for details on allowed hostnames + ::= { | | } + ::= ('#' | '$') + ::= + + Other parameter syntaxes are: + + ::= { } + ::= 'a' ... 'z' | 'A' ... 'Z' + ::= '0' ... '9' + ::= '-' | '[' | ']' | '\' | '`' | '^' | '{' | '}' + + + +Oikarinen & Reed [Page 9] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + ::= + +2.4 Numeric replies + + Most of the messages sent to the server generate a reply of some + sort. The most common reply is the numeric reply, used for both + errors and normal replies. The numeric reply must be sent as one + message consisting of the sender prefix, the three digit numeric, and + the target of the reply. A numeric reply is not allowed to originate + from a client; any such messages received by a server are silently + dropped. In all other respects, a numeric reply is just like a normal + message, except that the keyword is made up of 3 numeric digits + rather than a string of letters. A list of different replies is + supplied in section 6. + +3. IRC Concepts. + + This section is devoted to describing the actual concepts behind the + organization of the IRC protocol and how the current + implementations deliver different classes of messages. + + + + 1--\ + A D---4 + 2--/ \ / + B----C + / \ + 3 E + + Servers: A, B, C, D, E Clients: 1, 2, 3, 4 + + [ Fig. 2. Sample small IRC network ] + +3.1 One-to-one communication + + Communication on a one-to-one basis is usually only performed by + clients, since most server-server traffic is not a result of servers + talking only to each other. To provide a secure means for clients to + talk to each other, it is required that all servers be able to send a + message in exactly one direction along the spanning tree in order to + reach any client. The path of a message being delivered is the + shortest path between any two points on the spanning tree. + + The following examples all refer to Figure 2 above. + + + + + +Oikarinen & Reed [Page 10] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +Example 1: + A message between clients 1 and 2 is only seen by server A, which + sends it straight to client 2. + +Example 2: + A message between clients 1 and 3 is seen by servers A & B, and + client 3. No other clients or servers are allowed see the message. + +Example 3: + A message between clients 2 and 4 is seen by servers A, B, C & D + and client 4 only. + +3.2 One-to-many + + The main goal of IRC is to provide a forum which allows easy and + efficient conferencing (one to many conversations). IRC offers + several means to achieve this, each serving its own purpose. + +3.2.1 To a list + + The least efficient style of one-to-many conversation is through + clients talking to a 'list' of users. How this is done is almost + self explanatory: the client gives a list of destinations to which + the message is to be delivered and the server breaks it up and + dispatches a separate copy of the message to each given destination. + This isn't as efficient as using a group since the destination list + is broken up and the dispatch sent without checking to make sure + duplicates aren't sent down each path. + +3.2.2 To a group (channel) + + In IRC the channel has a role equivalent to that of the multicast + group; their existence is dynamic (coming and going as people join + and leave channels) and the actual conversation carried out on a + channel is only sent to servers which are supporting users on a given + channel. If there are multiple users on a server in the same + channel, the message text is sent only once to that server and then + sent to each client on the channel. This action is then repeated for + each client-server combination until the original message has fanned + out and reached each member of the channel. + + The following examples all refer to Figure 2. + +Example 4: + Any channel with 1 client in it. Messages to the channel go to the + server and then nowhere else. + + + + + +Oikarinen & Reed [Page 11] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +Example 5: + 2 clients in a channel. All messages traverse a path as if they + were private messages between the two clients outside a channel. + +Example 6: + Clients 1, 2 and 3 in a channel. All messages to the channel are + sent to all clients and only those servers which must be traversed + by the message if it were a private message to a single client. If + client 1 sends a message, it goes back to client 2 and then via + server B to client 3. + +3.2.3 To a host/server mask + + To provide IRC operators with some mechanism to send messages to a + large body of related users, host and server mask messages are + provided. These messages are sent to users whose host or server + information match that of the mask. The messages are only sent to + locations where users are, in a fashion similar to that of channels. + +3.3 One-to-all + + The one-to-all type of message is better described as a broadcast + message, sent to all clients or servers or both. On a large network + of users and servers, a single message can result in a lot of traffic + being sent over the network in an effort to reach all of the desired + destinations. + + For some messages, there is no option but to broadcast it to all + servers so that the state information held by each server is + reasonably consistent between servers. + +3.3.1 Client-to-Client + + There is no class of message which, from a single message, results in + a message being sent to every other client. + +3.3.2 Client-to-Server + + Most of the commands which result in a change of state information + (such as channel membership, channel mode, user status, etc) must be + sent to all servers by default, and this distribution may not be + changed by the client. + +3.3.3 Server-to-Server. + + While most messages between servers are distributed to all 'other' + servers, this is only required for any message that affects either a + user, channel or server. Since these are the basic items found in + + + +Oikarinen & Reed [Page 12] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + IRC, nearly all messages originating from a server are broadcast to + all other connected servers. + +4. Message details + + On the following pages are descriptions of each message recognized by + the IRC server and client. All commands described in this section + must be implemented by any server for this protocol. + + Where the reply ERR_NOSUCHSERVER is listed, it means that the + parameter could not be found. The server must not send any + other replies after this for that command. + + The server to which a client is connected is required to parse the + complete message, returning any appropriate errors. If the server + encounters a fatal error while parsing a message, an error must be + sent back to the client and the parsing terminated. A fatal error + may be considered to be incorrect command, a destination which is + otherwise unknown to the server (server, nick or channel names fit + this category), not enough parameters or incorrect privileges. + + If a full set of parameters is presented, then each must be checked + for validity and appropriate responses sent back to the client. In + the case of messages which use parameter lists using the comma as an + item separator, a reply must be sent for each item. + + In the examples below, some messages appear using the full format: + + :Name COMMAND parameter list + + Such examples represent a message from "Name" in transit between + servers, where it is essential to include the name of the original + sender of the message so remote servers may send back a reply along + the correct path. + +4.1 Connection Registration + + The commands described here are used to register a connection with an + IRC server as either a user or a server as well as correctly + disconnect. + + A "PASS" command is not required for either client or server + connection to be registered, but it must precede the server message + or the latter of the NICK/USER combination. It is strongly + recommended that all server connections have a password in order to + give some level of security to the actual connections. The + recommended order for a client to register is as follows: + + + + +Oikarinen & Reed [Page 13] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 1. Pass message + 2. Nick message + 3. User message + +4.1.1 Password message + + + Command: PASS + Parameters: + + The PASS command is used to set a 'connection password'. The + password can and must be set before any attempt to register the + connection is made. Currently this requires that clients send a PASS + command before sending the NICK/USER combination and servers *must* + send a PASS command before any SERVER command. The password supplied + must match the one contained in the C/N lines (for servers) or I + lines (for clients). It is possible to send multiple PASS commands + before registering but only the last one sent is used for + verification and it may not be changed once registered. Numeric + Replies: + + ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED + + Example: + + PASS secretpasswordhere + +4.1.2 Nick message + + Command: NICK + Parameters: [ ] + + NICK message is used to give user a nickname or change the previous + one. The parameter is only used by servers to indicate + how far away a nick is from its home server. A local connection has + a hopcount of 0. If supplied by a client, it must be ignored. + + If a NICK message arrives at a server which already knows about an + identical nickname for another client, a nickname collision occurs. + As a result of a nickname collision, all instances of the nickname + are removed from the server's database, and a KILL command is issued + to remove the nickname from all other server's database. If the NICK + message causing the collision was a nickname change, then the + original (old) nick must be removed as well. + + If the server recieves an identical NICK from a client which is + directly connected, it may issue an ERR_NICKCOLLISION to the local + client, drop the NICK command, and not generate any kills. + + + +Oikarinen & Reed [Page 14] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + Numeric Replies: + + ERR_NONICKNAMEGIVEN ERR_ERRONEUSNICKNAME + ERR_NICKNAMEINUSE ERR_NICKCOLLISION + + Example: + + NICK Wiz ; Introducing new nick "Wiz". + + :WiZ NICK Kilroy ; WiZ changed his nickname to Kilroy. + +4.1.3 User message + + Command: USER + Parameters: + + The USER message is used at the beginning of connection to specify + the username, hostname, servername and realname of s new user. It is + also used in communication between servers to indicate new user + arriving on IRC, since only after both USER and NICK have been + received from a client does a user become registered. + + Between servers USER must to be prefixed with client's NICKname. + Note that hostname and servername are normally ignored by the IRC + server when the USER command comes from a directly connected client + (for security reasons), but they are used in server to server + communication. This means that a NICK must always be sent to a + remote server when a new user is being introduced to the rest of the + network before the accompanying USER is sent. + + It must be noted that realname parameter must be the last parameter, + because it may contain space characters and must be prefixed with a + colon (':') to make sure this is recognised as such. + + Since it is easy for a client to lie about its username by relying + solely on the USER message, the use of an "Identity Server" is + recommended. If the host which a user connects from has such a + server enabled the username is set to that as in the reply from the + "Identity Server". + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED + + Examples: + + + USER guest tolmoon tolsun :Ronnie Reagan + + + +Oikarinen & Reed [Page 15] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + ; User registering themselves with a + username of "guest" and real name + "Ronnie Reagan". + + + :testnick USER guest tolmoon tolsun :Ronnie Reagan + ; message between servers with the + nickname for which the USER command + belongs to + +4.1.4 Server message + + Command: SERVER + Parameters: + + The server message is used to tell a server that the other end of a + new connection is a server. This message is also used to pass server + data over whole net. When a new server is connected to net, + information about it be broadcast to the whole network. + is used to give all servers some internal information on how far away + all servers are. With a full server list, it would be possible to + construct a map of the entire server tree, but hostmasks prevent this + from being done. + + The SERVER message must only be accepted from either (a) a connection + which is yet to be registered and is attempting to register as a + server, or (b) an existing connection to another server, in which + case the SERVER message is introducing a new server behind that + server. + + Most errors that occur with the receipt of a SERVER command result in + the connection being terminated by the destination host (target + SERVER). Error replies are usually sent using the "ERROR" command + rather than the numeric since the ERROR command has several useful + properties which make it useful here. + + If a SERVER message is parsed and attempts to introduce a server + which is already known to the receiving server, the connection from + which that message must be closed (following the correct procedures), + since a duplicate route to a server has formed and the acyclic nature + of the IRC tree broken. + + Numeric Replies: + + ERR_ALREADYREGISTRED + + Example: + + + + +Oikarinen & Reed [Page 16] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +SERVER test.oulu.fi 1 :[tolsun.oulu.fi] Experimental server + ; New server test.oulu.fi introducing + itself and attempting to register. The + name in []'s is the hostname for the + host running test.oulu.fi. + + +:tolsun.oulu.fi SERVER csd.bu.edu 5 :BU Central Server + ; Server tolsun.oulu.fi is our uplink + for csd.bu.edu which is 5 hops away. + +4.1.5 Oper + + Command: OPER + Parameters: + + OPER message is used by a normal user to obtain operator privileges. + The combination of and are required to gain + Operator privileges. + + If the client sending the OPER command supplies the correct password + for the given user, the server then informs the rest of the network + of the new operator by issuing a "MODE +o" for the clients nickname. + + The OPER message is client-server only. + + Numeric Replies: + + ERR_NEEDMOREPARAMS RPL_YOUREOPER + ERR_NOOPERHOST ERR_PASSWDMISMATCH + + Example: + + OPER foo bar ; Attempt to register as an operator + using a username of "foo" and "bar" as + the password. + +4.1.6 Quit + + Command: QUIT + Parameters: [] + + A client session is ended with a quit message. The server must close + the connection to a client which sends a QUIT message. If a "Quit + Message" is given, this will be sent instead of the default message, + the nickname. + + When netsplits (disconnecting of two servers) occur, the quit message + + + +Oikarinen & Reed [Page 17] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + is composed of the names of two servers involved, separated by a + space. The first name is that of the server which is still connected + and the second name is that of the server that has become + disconnected. + + If, for some other reason, a client connection is closed without the + client issuing a QUIT command (e.g. client dies and EOF occurs + on socket), the server is required to fill in the quit message with + some sort of message reflecting the nature of the event which + caused it to happen. + + Numeric Replies: + + None. + + Examples: + + QUIT :Gone to have lunch ; Preferred message format. + +4.1.7 Server quit message + + Command: SQUIT + Parameters: + + The SQUIT message is needed to tell about quitting or dead servers. + If a server wishes to break the connection to another server it must + send a SQUIT message to the other server, using the the name of the + other server as the server parameter, which then closes its + connection to the quitting server. + + This command is also available operators to help keep a network of + IRC servers connected in an orderly fashion. Operators may also + issue an SQUIT message for a remote server connection. In this case, + the SQUIT must be parsed by each server inbetween the operator and + the remote server, updating the view of the network held by each + server as explained below. + + The should be supplied by all operators who execute a SQUIT + for a remote server (that is not connected to the server they are + currently on) so that other operators are aware for the reason of + this action. The is also filled in by servers which may + place an error or similar message here. + + Both of the servers which are on either side of the connection being + closed are required to to send out a SQUIT message (to all its other + server connections) for all other servers which are considered to be + behind that link. + + + + +Oikarinen & Reed [Page 18] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + Similarly, a QUIT message must be sent to the other connected servers + rest of the network on behalf of all clients behind that link. In + addition to this, all channel members of a channel which lost a + member due to the split must be sent a QUIT message. + + If a server connection is terminated prematurely (e.g. the server on + the other end of the link died), the server which detects + this disconnection is required to inform the rest of the network + that the connection has closed and fill in the comment field + with something appropriate. + + Numeric replies: + + ERR_NOPRIVILEGES ERR_NOSUCHSERVER + + Example: + + SQUIT tolsun.oulu.fi :Bad Link ? ; the server link tolson.oulu.fi has + been terminated because of "Bad Link". + + :Trillian SQUIT cm22.eng.umd.edu :Server out of control + ; message from Trillian to disconnect + "cm22.eng.umd.edu" from the net + because "Server out of control". + +4.2 Channel operations + + This group of messages is concerned with manipulating channels, their + properties (channel modes), and their contents (typically clients). + In implementing these, a number of race conditions are inevitable + when clients at opposing ends of a network send commands which will + ultimately clash. It is also required that servers keep a nickname + history to ensure that wherever a parameter is given, the + server check its history in case it has recently been changed. + +4.2.1 Join message + + Command: JOIN + Parameters: {,} [{,}] + + The JOIN command is used by client to start listening a specific + channel. Whether or not a client is allowed to join a channel is + checked only by the server the client is connected to; all other + servers automatically add the user to the channel when it is received + from other servers. The conditions which affect this are as follows: + + 1. the user must be invited if the channel is invite-only; + + + + +Oikarinen & Reed [Page 19] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 2. the user's nick/username/hostname must not match any + active bans; + + 3. the correct key (password) must be given if it is set. + + These are discussed in more detail under the MODE command (see + section 4.2.3 for more details). + + Once a user has joined a channel, they receive notice about all + commands their server receives which affect the channel. This + includes MODE, KICK, PART, QUIT and of course PRIVMSG/NOTICE. The + JOIN command needs to be broadcast to all servers so that each server + knows where to find the users who are on the channel. This allows + optimal delivery of PRIVMSG/NOTICE messages to the channel. + + If a JOIN is successful, the user is then sent the channel's topic + (using RPL_TOPIC) and the list of users who are on the channel (using + RPL_NAMREPLY), which must include the user joining. + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_BANNEDFROMCHAN + ERR_INVITEONLYCHAN ERR_BADCHANNELKEY + ERR_CHANNELISFULL ERR_BADCHANMASK + ERR_NOSUCHCHANNEL ERR_TOOMANYCHANNELS + RPL_TOPIC + + Examples: + + JOIN #foobar ; join channel #foobar. + + JOIN &foo fubar ; join channel &foo using key "fubar". + + JOIN #foo,&bar fubar ; join channel #foo using key "fubar" + and &bar using no key. + + JOIN #foo,#bar fubar,foobar ; join channel #foo using key "fubar". + and channel #bar using key "foobar". + + JOIN #foo,#bar ; join channels #foo and #bar. + + :WiZ JOIN #Twilight_zone ; JOIN message from WiZ + +4.2.2 Part message + + Command: PART + Parameters: {,} + + + + +Oikarinen & Reed [Page 20] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + The PART message causes the client sending the message to be removed + from the list of active users for all given channels listed in the + parameter string. + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_NOSUCHCHANNEL + ERR_NOTONCHANNEL + + Examples: + + PART #twilight_zone ; leave channel "#twilight_zone" + + PART #oz-ops,&group5 ; leave both channels "&group5" and + "#oz-ops". + +4.2.3 Mode message + + Command: MODE + + The MODE command is a dual-purpose command in IRC. It allows both + usernames and channels to have their mode changed. The rationale for + this choice is that one day nicknames will be obsolete and the + equivalent property will be the channel. + + When parsing MODE messages, it is recommended that the entire message + be parsed first and then the changes which resulted then passed on. + +4.2.3.1 Channel modes + + Parameters: {[+|-]|o|p|s|i|t|n|b|v} [] [] + [] + + The MODE command is provided so that channel operators may change the + characteristics of `their' channel. It is also required that servers + be able to change channel modes so that channel operators may be + created. + + The various modes available for channels are as follows: + + o - give/take channel operator privileges; + p - private channel flag; + s - secret channel flag; + i - invite-only channel flag; + t - topic settable by channel operator only flag; + n - no messages to channel from clients on the outside; + m - moderated channel; + l - set the user limit to channel; + + + +Oikarinen & Reed [Page 21] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + b - set a ban mask to keep users out; + v - give/take the ability to speak on a moderated channel; + k - set a channel key (password). + + When using the 'o' and 'b' options, a restriction on a total of three + per mode command has been imposed. That is, any combination of 'o' + and + +4.2.3.2 User modes + + Parameters: {[+|-]|i|w|s|o} + + The user MODEs are typically changes which affect either how the + client is seen by others or what 'extra' messages the client is sent. + A user MODE command may only be accepted if both the sender of the + message and the nickname given as a parameter are both the same. + + The available modes are as follows: + + i - marks a users as invisible; + s - marks a user for receipt of server notices; + w - user receives wallops; + o - operator flag. + + Additional modes may be available later on. + + If a user attempts to make themselves an operator using the "+o" + flag, the attempt should be ignored. There is no restriction, + however, on anyone `deopping' themselves (using "-o"). Numeric + Replies: + + ERR_NEEDMOREPARAMS RPL_CHANNELMODEIS + ERR_CHANOPRIVSNEEDED ERR_NOSUCHNICK + ERR_NOTONCHANNEL ERR_KEYSET + RPL_BANLIST RPL_ENDOFBANLIST + ERR_UNKNOWNMODE ERR_NOSUCHCHANNEL + + ERR_USERSDONTMATCH RPL_UMODEIS + ERR_UMODEUNKNOWNFLAG + + Examples: + + Use of Channel Modes: + +MODE #Finnish +im ; Makes #Finnish channel moderated and + 'invite-only'. + +MODE #Finnish +o Kilroy ; Gives 'chanop' privileges to Kilroy on + + + +Oikarinen & Reed [Page 22] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + channel #Finnish. + +MODE #Finnish +v Wiz ; Allow WiZ to speak on #Finnish. + +MODE #Fins -s ; Removes 'secret' flag from channel + #Fins. + +MODE #42 +k oulu ; Set the channel key to "oulu". + +MODE #eu-opers +l 10 ; Set the limit for the number of users + on channel to 10. + +MODE &oulu +b ; list ban masks set for channel. + +MODE &oulu +b *!*@* ; prevent all users from joining. + +MODE &oulu +b *!*@*.edu ; prevent any user from a hostname + matching *.edu from joining. + + Use of user Modes: + +:MODE WiZ -w ; turns reception of WALLOPS messages + off for WiZ. + +:Angel MODE Angel +i ; Message from Angel to make themselves + invisible. + +MODE WiZ -o ; WiZ 'deopping' (removing operator + status). The plain reverse of this + command ("MODE WiZ +o") must not be + allowed from users since would bypass + the OPER command. + +4.2.4 Topic message + + Command: TOPIC + Parameters: [] + + The TOPIC message is used to change or view the topic of a channel. + The topic for channel is returned if there is no + given. If the parameter is present, the topic for that + channel will be changed, if the channel modes permit this action. + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_NOTONCHANNEL + RPL_NOTOPIC RPL_TOPIC + ERR_CHANOPRIVSNEEDED + + + +Oikarinen & Reed [Page 23] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + Examples: + + :Wiz TOPIC #test :New topic ;User Wiz setting the topic. + + TOPIC #test :another topic ;set the topic on #test to "another + topic". + + TOPIC #test ; check the topic for #test. + +4.2.5 Names message + + Command: NAMES + Parameters: [{,}] + + By using the NAMES command, a user can list all nicknames that are + visible to them on any channel that they can see. Channel names + which they can see are those which aren't private (+p) or secret (+s) + or those which they are actually on. The parameter + specifies which channel(s) to return information about if valid. + There is no error reply for bad channel names. + + If no parameter is given, a list of all channels and their + occupants is returned. At the end of this list, a list of users who + are visible but either not on any channel or not on a visible channel + are listed as being on `channel' "*". + + Numerics: + + RPL_NAMREPLY RPL_ENDOFNAMES + + Examples: + + NAMES #twilight_zone,#42 ; list visible users on #twilight_zone + and #42 if the channels are visible to + you. + + NAMES ; list all visible channels and users + +4.2.6 List message + + Command: LIST + Parameters: [{,} []] + + The list message is used to list channels and their topics. If the + parameter is used, only the status of that channel + is displayed. Private channels are listed (without their + topics) as channel "Prv" unless the client generating the query is + actually on that channel. Likewise, secret channels are not listed + + + +Oikarinen & Reed [Page 24] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + at all unless the client is a member of the channel in question. + + Numeric Replies: + + ERR_NOSUCHSERVER RPL_LISTSTART + RPL_LIST RPL_LISTEND + + Examples: + + LIST ; List all channels. + + LIST #twilight_zone,#42 ; List channels #twilight_zone and #42 + +4.2.7 Invite message + + Command: INVITE + Parameters: + + The INVITE message is used to invite users to a channel. The + parameter is the nickname of the person to be invited to + the target channel . There is no requirement that the + channel the target user is being invited to must exist or be a valid + channel. To invite a user to a channel which is invite only (MODE + +i), the client sending the invite must be recognised as being a + channel operator on the given channel. + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_NOSUCHNICK + ERR_NOTONCHANNEL ERR_USERONCHANNEL + ERR_CHANOPRIVSNEEDED + RPL_INVITING RPL_AWAY + + Examples: + + :Angel INVITE Wiz #Dust ; User Angel inviting WiZ to channel + #Dust + + INVITE Wiz #Twilight_Zone ; Command to invite WiZ to + #Twilight_zone + +4.2.8 Kick command + + Command: KICK + Parameters: [] + + The KICK command can be used to forcibly remove a user from a + channel. It 'kicks them out' of the channel (forced PART). + + + +Oikarinen & Reed [Page 25] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + Only a channel operator may kick another user out of a channel. + Each server that receives a KICK message checks that it is valid + (ie the sender is actually a channel operator) before removing + the victim from the channel. + + Numeric Replies: + + ERR_NEEDMOREPARAMS ERR_NOSUCHCHANNEL + ERR_BADCHANMASK ERR_CHANOPRIVSNEEDED + ERR_NOTONCHANNEL + + Examples: + +KICK &Melbourne Matthew ; Kick Matthew from &Melbourne + +KICK #Finnish John :Speaking English + ; Kick John from #Finnish using + "Speaking English" as the reason + (comment). + +:WiZ KICK #Finnish John ; KICK message from WiZ to remove John + from channel #Finnish + +NOTE: + It is possible to extend the KICK command parameters to the +following: + +{,} {,} [] + +4.3 Server queries and commands + + The server query group of commands has been designed to return + information about any server which is connected to the network. All + servers connected must respond to these queries and respond + correctly. Any invalid response (or lack thereof) must be considered + a sign of a broken server and it must be disconnected/disabled as + soon as possible until the situation is remedied. + + In these queries, where a parameter appears as "", it will + usually mean it can be a nickname or a server or a wildcard name of + some sort. For each parameter, however, only one query and set of + replies is to be generated. + +4.3.1 Version message + + Command: VERSION + Parameters: [] + + + + +Oikarinen & Reed [Page 26] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + The VERSION message is used to query the version of the server + program. An optional parameter is used to query the version + of the server program which a client is not directly connected to. + + Numeric Replies: + + ERR_NOSUCHSERVER RPL_VERSION + + Examples: + + :Wiz VERSION *.se ; message from Wiz to check the version + of a server matching "*.se" + + VERSION tolsun.oulu.fi ; check the version of server + "tolsun.oulu.fi". + +4.3.2 Stats message + + Command: STATS + Parameters: [ []] + + The stats message is used to query statistics of certain server. If + parameter is omitted, only the end of stats reply is sent + back. The implementation of this command is highly dependent on the + server which replies, although the server must be able to supply + information as described by the queries below (or similar). + + A query may be given by any single letter which is only checked by + the destination server (if given as the parameter) and is + otherwise passed on by intermediate servers, ignored and unaltered. + The following queries are those found in the current IRC + implementation and provide a large portion of the setup information + for that server. Although these may not be supported in the same way + by other versions, all servers should be able to supply a valid reply + to a STATS query which is consistent with the reply formats currently + used and the purpose of the query. + + The currently supported queries are: + + c - returns a list of servers which the server may connect + to or allow connections from; + h - returns a list of servers which are either forced to be + treated as leaves or allowed to act as hubs; + i - returns a list of hosts which the server allows a client + to connect from; + k - returns a list of banned username/hostname combinations + for that server; + l - returns a list of the server's connections, showing how + + + +Oikarinen & Reed [Page 27] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + long each connection has been established and the traffic + over that connection in bytes and messages for each + direction; + m - returns a list of commands supported by the server and + the usage count for each if the usage count is non zero; + o - returns a list of hosts from which normal clients may + become operators; + y - show Y (Class) lines from server's configuration file; + u - returns a string showing how long the server has been up. + + Numeric Replies: + + ERR_NOSUCHSERVER + RPL_STATSCLINE RPL_STATSNLINE + RPL_STATSILINE RPL_STATSKLINE + RPL_STATSQLINE RPL_STATSLLINE + RPL_STATSLINKINFO RPL_STATSUPTIME + RPL_STATSCOMMANDS RPL_STATSOLINE + RPL_STATSHLINE RPL_ENDOFSTATS + + Examples: + +STATS m ; check the command usage for the server + you are connected to + +:Wiz STATS c eff.org ; request by WiZ for C/N line + information from server eff.org + +4.3.3 Links message + + Command: LINKS + Parameters: [[] ] + + With LINKS, a user can list all servers which are known by the server + answering the query. The returned list of servers must match the + mask, or if no mask is given, the full list is returned. + + If is given in addition to , the LINKS + command is forwarded to the first server found that matches that name + (if any), and that server is then required to answer the query. + + Numeric Replies: + + ERR_NOSUCHSERVER + RPL_LINKS RPL_ENDOFLINKS + + Examples: + + + + +Oikarinen & Reed [Page 28] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +LINKS *.au ; list all servers which have a name + that matches *.au; + +:WiZ LINKS *.bu.edu *.edu ; LINKS message from WiZ to the first + server matching *.edu for a list of + servers matching *.bu.edu. + +4.3.4 Time message + + Command: TIME + Parameters: [] + + The time message is used to query local time from the specified + server. If the server parameter is not given, the server handling the + command must reply to the query. + + Numeric Replies: + + ERR_NOSUCHSERVER RPL_TIME + + Examples: + + TIME tolsun.oulu.fi ; check the time on the server + "tolson.oulu.fi" + + Angel TIME *.au ; user angel checking the time on a + server matching "*.au" + +4.3.5 Connect message + + Command: CONNECT + Parameters: [ []] + + The CONNECT command can be used to force a server to try to establish + a new connection to another server immediately. CONNECT is a + privileged command and is to be available only to IRC Operators. If + a remote server is given then the CONNECT attempt is made by that + server to and . + + Numeric Replies: + + ERR_NOSUCHSERVER ERR_NOPRIVILEGES + ERR_NEEDMOREPARAMS + + Examples: + +CONNECT tolsun.oulu.fi ; Attempt to connect a server to + tolsun.oulu.fi + + + +Oikarinen & Reed [Page 29] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +:WiZ CONNECT eff.org 6667 csd.bu.edu + ; CONNECT attempt by WiZ to get servers + eff.org and csd.bu.edu connected on port + 6667. + +4.3.6 Trace message + + Command: TRACE + Parameters: [] + + TRACE command is used to find the route to specific server. Each + server that processes this message must tell the sender about it by + sending a reply indicating it is a pass-through link, forming a chain + of replies similar to that gained from using "traceroute". After + sending this reply back, it must then send the TRACE message to the + next server until given server is reached. If the parameter + is omitted, it is recommended that TRACE command send a message to + the sender telling which servers the current server has direct + connection to. + + If the destination given by "" is an actual server, then the + destination server is required to report all servers and users which + are connected to it, although only operators are permitted to see + users present. If the destination given by is a nickname, + they only a reply for that nickname is given. + + Numeric Replies: + + ERR_NOSUCHSERVER + + If the TRACE message is destined for another server, all intermediate + servers must return a RPL_TRACELINK reply to indicate that the TRACE + passed through it and where its going next. + + RPL_TRACELINK + A TRACE reply may be composed of any number of the following numeric + replies. + + RPL_TRACECONNECTING RPL_TRACEHANDSHAKE + RPL_TRACEUNKNOWN RPL_TRACEOPERATOR + RPL_TRACEUSER RPL_TRACESERVER + RPL_TRACESERVICE RPL_TRACENEWTYPE + RPL_TRACECLASS + + Examples: + +TRACE *.oulu.fi ; TRACE to a server matching *.oulu.fi + + + + +Oikarinen & Reed [Page 30] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +:WiZ TRACE AngelDust ; TRACE issued by WiZ to nick AngelDust + +4.3.7 Admin command + + Command: ADMIN + Parameters: [] + + The admin message is used to find the name of the administrator of + the given server, or current server if parameter is omitted. + Each server must have the ability to forward ADMIN messages to other + servers. + + Numeric Replies: + + ERR_NOSUCHSERVER + RPL_ADMINME RPL_ADMINLOC1 + RPL_ADMINLOC2 RPL_ADMINEMAIL + + Examples: + + ADMIN tolsun.oulu.fi ; request an ADMIN reply from + tolsun.oulu.fi + + :WiZ ADMIN *.edu ; ADMIN request from WiZ for first + server found to match *.edu. + +4.3.8 Info command + + Command: INFO + Parameters: [] + + The INFO command is required to return information which describes + the server: its version, when it was compiled, the patchlevel, when + it was started, and any other miscellaneous information which may be + considered to be relevant. + + Numeric Replies: + + ERR_NOSUCHSERVER + RPL_INFO RPL_ENDOFINFO + + Examples: + + INFO csd.bu.edu ; request an INFO reply from + csd.bu.edu + + :Avalon INFO *.fi ; INFO request from Avalon for first + server found to match *.fi. + + + +Oikarinen & Reed [Page 31] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + INFO Angel ; request info from the server that + Angel is connected to. + +4.4 Sending messages + + The main purpose of the IRC protocol is to provide a base for clients + to communicate with each other. PRIVMSG and NOTICE are the only + messages available which actually perform delivery of a text message + from one client to another - the rest just make it possible and try + to ensure it happens in a reliable and structured manner. + +4.4.1 Private messages + + Command: PRIVMSG + Parameters: {,} + + PRIVMSG is used to send private messages between users. + is the nickname of the receiver of the message. can also + be a list of names or channels separated with commas. + + The parameter may also me a host mask (#mask) or server + mask ($mask). In both cases the server will only send the PRIVMSG + to those who have a server or host matching the mask. The mask must + have at least 1 (one) "." in it and no wildcards following the + last ".". This requirement exists to prevent people sending messages + to "#*" or "$*", which would broadcast to all users; from + experience, this is abused more than used responsibly and properly. + Wildcards are the '*' and '?' characters. This extension to + the PRIVMSG command is only available to Operators. + + Numeric Replies: + + ERR_NORECIPIENT ERR_NOTEXTTOSEND + ERR_CANNOTSENDTOCHAN ERR_NOTOPLEVEL + ERR_WILDTOPLEVEL ERR_TOOMANYTARGETS + ERR_NOSUCHNICK + RPL_AWAY + + Examples: + +:Angel PRIVMSG Wiz :Hello are you receiving this message ? + ; Message from Angel to Wiz. + +PRIVMSG Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br ; + Message to Angel. + +PRIVMSG jto@tolsun.oulu.fi :Hello ! + ; Message to a client on server + + + +Oikarinen & Reed [Page 32] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + tolsun.oulu.fi with username of "jto". + +PRIVMSG $*.fi :Server tolsun.oulu.fi rebooting. + ; Message to everyone on a server which + has a name matching *.fi. + +PRIVMSG #*.edu :NSFNet is undergoing work, expect interruptions + ; Message to all users who come from a + host which has a name matching *.edu. + +4.4.2 Notice + + Command: NOTICE + Parameters: + + The NOTICE message is used similarly to PRIVMSG. The difference + between NOTICE and PRIVMSG is that automatic replies must never be + sent in response to a NOTICE message. This rule applies to servers + too - they must not send any error reply back to the client on + receipt of a notice. The object of this rule is to avoid loops + between a client automatically sending something in response to + something it received. This is typically used by automatons (clients + with either an AI or other interactive program controlling their + actions) which are always seen to be replying lest they end up in a + loop with another automaton. + + See PRIVMSG for more details on replies and examples. + +4.5 User based queries + + User queries are a group of commands which are primarily concerned + with finding details on a particular user or group users. When using + wildcards with any of these commands, if they match, they will only + return information on users who are 'visible' to you. The visibility + of a user is determined as a combination of the user's mode and the + common set of channels you are both on. + +4.5.1 Who query + + Command: WHO + Parameters: [ []] + + The WHO message is used by a client to generate a query which returns + a list of information which 'matches' the parameter given by + the client. In the absence of the parameter, all visible + (users who aren't invisible (user mode +i) and who don't have a + common channel with the requesting client) are listed. The same + result can be achieved by using a of "0" or any wildcard which + + + +Oikarinen & Reed [Page 33] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + will end up matching every entry possible. + + The passed to WHO is matched against users' host, server, real + name and nickname if the channel cannot be found. + + If the "o" parameter is passed only operators are returned according + to the name mask supplied. + + Numeric Replies: + + ERR_NOSUCHSERVER + RPL_WHOREPLY RPL_ENDOFWHO + + Examples: + + WHO *.fi ; List all users who match against + "*.fi". + + WHO jto* o ; List all users with a match against + "jto*" if they are an operator. + +4.5.2 Whois query + + Command: WHOIS + Parameters: [] [,[,...]] + + This message is used to query information about particular user. The + server will answer this message with several numeric messages + indicating different statuses of each user which matches the nickmask + (if you are entitled to see them). If no wildcard is present in the + , any information about that nick which you are allowed to + see is presented. A comma (',') separated list of nicknames may be + given. + + The latter version sends the query to a specific server. It is + useful if you want to know how long the user in question has been + idle as only local server (ie. the server the user is directly + connected to) knows that information, while everything else is + globally known. + + Numeric Replies: + + ERR_NOSUCHSERVER ERR_NONICKNAMEGIVEN + RPL_WHOISUSER RPL_WHOISCHANNELS + RPL_WHOISCHANNELS RPL_WHOISSERVER + RPL_AWAY RPL_WHOISOPERATOR + RPL_WHOISIDLE ERR_NOSUCHNICK + RPL_ENDOFWHOIS + + + +Oikarinen & Reed [Page 34] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + Examples: + + WHOIS wiz ; return available user information + about nick WiZ + + WHOIS eff.org trillian ; ask server eff.org for user + information about trillian + +4.5.3 Whowas + + Command: WHOWAS + Parameters: [ []] + + Whowas asks for information about a nickname which no longer exists. + This may either be due to a nickname change or the user leaving IRC. + In response to this query, the server searches through its nickname + history, looking for any nicks which are lexically the same (no wild + card matching here). The history is searched backward, returning the + most recent entry first. If there are multiple entries, up to + replies will be returned (or all of them if no + parameter is given). If a non-positive number is passed as being + , then a full search is done. + + Numeric Replies: + + ERR_NONICKNAMEGIVEN ERR_WASNOSUCHNICK + RPL_WHOWASUSER RPL_WHOISSERVER + RPL_ENDOFWHOWAS + + Examples: + + WHOWAS Wiz ; return all information in the nick + history about nick "WiZ"; + + WHOWAS Mermaid 9 ; return at most, the 9 most recent + entries in the nick history for + "Mermaid"; + + WHOWAS Trillian 1 *.edu ; return the most recent history for + "Trillian" from the first server found + to match "*.edu". + +4.6 Miscellaneous messages + + Messages in this category do not fit into any of the above categories + but are nonetheless still a part of and required by the protocol. + + + + + +Oikarinen & Reed [Page 35] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +4.6.1 Kill message + + Command: KILL + Parameters: + + The KILL message is used to cause a client-server connection to be + closed by the server which has the actual connection. KILL is used + by servers when they encounter a duplicate entry in the list of valid + nicknames and is used to remove both entries. It is also available + to operators. + + Clients which have automatic reconnect algorithms effectively make + this command useless since the disconnection is only brief. It does + however break the flow of data and can be used to stop large amounts + of being abused, any user may elect to receive KILL messages + generated for others to keep an 'eye' on would be trouble spots. + + In an arena where nicknames are required to be globally unique at all + times, KILL messages are sent whenever 'duplicates' are detected + (that is an attempt to register two users with the same nickname) in + the hope that both of them will disappear and only 1 reappear. + + The comment given must reflect the actual reason for the KILL. For + server-generated KILLs it usually is made up of details concerning + the origins of the two conflicting nicknames. For users it is left + up to them to provide an adequate reason to satisfy others who see + it. To prevent/discourage fake KILLs from being generated to hide + the identify of the KILLer, the comment also shows a 'kill-path' + which is updated by each server it passes through, each prepending + its name to the path. + + Numeric Replies: + + ERR_NOPRIVILEGES ERR_NEEDMOREPARAMS + ERR_NOSUCHNICK ERR_CANTKILLSERVER + + + KILL David (csd.bu.edu <- tolsun.oulu.fi) + ; Nickname collision between csd.bu.edu + and tolson.oulu.fi + + + NOTE: + It is recommended that only Operators be allowed to kill other users + with KILL message. In an ideal world not even operators would need + to do this and it would be left to servers to deal with. + + + + + +Oikarinen & Reed [Page 36] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +4.6.2 Ping message + + Command: PING + Parameters: [] + + The PING message is used to test the presence of an active client at + the other end of the connection. A PING message is sent at regular + intervals if no other activity detected coming from a connection. If + a connection fails to respond to a PING command within a set amount + of time, that connection is closed. + + Any client which receives a PING message must respond to + (server which sent the PING message out) as quickly as possible with + an appropriate PONG message to indicate it is still there and alive. + Servers should not respond to PING commands but rely on PINGs from + the other end of the connection to indicate the connection is alive. + If the parameter is specified, the PING message gets + forwarded there. + + Numeric Replies: + + ERR_NOORIGIN ERR_NOSUCHSERVER + + Examples: + + PING tolsun.oulu.fi ; server sending a PING message to + another server to indicate it is still + alive. + + PING WiZ ; PING message being sent to nick WiZ + +4.6.3 Pong message + + Command: PONG + Parameters: [] + + PONG message is a reply to ping message. If parameter is + given this message must be forwarded to given daemon. The + parameter is the name of the daemon who has responded to PING message + and generated this message. + + Numeric Replies: + + ERR_NOORIGIN ERR_NOSUCHSERVER + + Examples: + + PONG csd.bu.edu tolsun.oulu.fi ; PONG message from csd.bu.edu to + + + +Oikarinen & Reed [Page 37] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + tolsun.oulu.fi + +4.6.4 Error + + Command: ERROR + Parameters: + + The ERROR command is for use by servers when reporting a serious or + fatal error to its operators. It may also be sent from one server to + another but must not be accepted from any normal unknown clients. + + An ERROR message is for use for reporting errors which occur with a + server-to-server link only. An ERROR message is sent to the server + at the other end (which sends it to all of its connected operators) + and to all operators currently connected. It is not to be passed + onto any other servers by a server if it is received from a server. + + When a server sends a received ERROR message to its operators, the + message should be encapsulated inside a NOTICE message, indicating + that the client was not responsible for the error. + + Numerics: + + None. + + Examples: + + ERROR :Server *.fi already exists; ERROR message to the other server + which caused this error. + + NOTICE WiZ :ERROR from csd.bu.edu -- Server *.fi already exists + ; Same ERROR message as above but sent + to user WiZ on the other server. + +5. OPTIONALS + + This section describes OPTIONAL messages. They are not required in a + working server implementation of the protocol described herein. In + the absence of the option, an error reply message must be generated + or an unknown command error. If the message is destined for another + server to answer then it must be passed on (elementary parsing + required) The allocated numerics for this are listed with the + messages below. + +5.1 Away + + Command: AWAY + Parameters: [message] + + + +Oikarinen & Reed [Page 38] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + With the AWAY message, clients can set an automatic reply string for + any PRIVMSG commands directed at them (not to a channel they are on). + The automatic reply is sent by the server to client sending the + PRIVMSG command. The only replying server is the one to which the + sending client is connected to. + + The AWAY message is used either with one parameter (to set an AWAY + message) or with no parameters (to remove the AWAY message). + + Numeric Replies: + + RPL_UNAWAY RPL_NOWAWAY + + Examples: + + AWAY :Gone to lunch. Back in 5 ; set away message to "Gone to lunch. + Back in 5". + + :WiZ AWAY ; unmark WiZ as being away. + + +5.2 Rehash message + + Command: REHASH + Parameters: None + + The rehash message can be used by the operator to force the server to + re-read and process its configuration file. + + Numeric Replies: + + RPL_REHASHING ERR_NOPRIVILEGES + +Examples: + +REHASH ; message from client with operator + status to server asking it to reread its + configuration file. + +5.3 Restart message + + Command: RESTART + Parameters: None + + The restart message can only be used by an operator to force a server + restart itself. This message is optional since it may be viewed as a + risk to allow arbitrary people to connect to a server as an operator + and execute this command, causing (at least) a disruption to service. + + + +Oikarinen & Reed [Page 39] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + The RESTART command must always be fully processed by the server to + which the sending client is connected and not be passed onto other + connected servers. + + Numeric Replies: + + ERR_NOPRIVILEGES + + Examples: + + RESTART ; no parameters required. + +5.4 Summon message + + Command: SUMMON + Parameters: [] + + The SUMMON command can be used to give users who are on a host + running an IRC server a message asking them to please join IRC. This + message is only sent if the target server (a) has SUMMON enabled, (b) + the user is logged in and (c) the server process can write to the + user's tty (or similar). + + If no parameter is given it tries to summon from the + server the client is connected to is assumed as the target. + + If summon is not enabled in a server, it must return the + ERR_SUMMONDISABLED numeric and pass the summon message onwards. + + Numeric Replies: + + ERR_NORECIPIENT ERR_FILEERROR + ERR_NOLOGIN ERR_NOSUCHSERVER + RPL_SUMMONING + + Examples: + + SUMMON jto ; summon user jto on the server's host + + SUMMON jto tolsun.oulu.fi ; summon user jto on the host which a + server named "tolsun.oulu.fi" is + running. + + +5.5 Users + + Command: USERS + Parameters: [] + + + +Oikarinen & Reed [Page 40] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + The USERS command returns a list of users logged into the server in a + similar format to who(1), rusers(1) and finger(1). Some people + may disable this command on their server for security related + reasons. If disabled, the correct numeric must be returned to + indicate this. + + Numeric Replies: + + ERR_NOSUCHSERVER ERR_FILEERROR + RPL_USERSSTART RPL_USERS + RPL_NOUSERS RPL_ENDOFUSERS + ERR_USERSDISABLED + + Disabled Reply: + + ERR_USERSDISABLED + + Examples: + +USERS eff.org ; request a list of users logged in on + server eff.org + +:John USERS tolsun.oulu.fi ; request from John for a list of users + logged in on server tolsun.oulu.fi + +5.6 Operwall message + + Command: WALLOPS + Parameters: Text to be sent to all operators currently online + + Sends a message to all operators currently online. After + implementing WALLOPS as a user command it was found that it was + often and commonly abused as a means of sending a message to a lot + of people (much similar to WALL). Due to this it is recommended + that the current implementation of WALLOPS be used as an + example by allowing and recognising only servers as the senders of + WALLOPS. + + Numeric Replies: + + ERR_NEEDMOREPARAMS + + Examples: + + :csd.bu.edu WALLOPS :Connect '*.uiuc.edu 6667' from Joshua; WALLOPS + message from csd.bu.edu announcing a + CONNECT message it received and acted + upon from Joshua. + + + +Oikarinen & Reed [Page 41] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +5.7 Userhost message + + Command: USERHOST + Parameters: {} + + The USERHOST command takes a list of up to 5 nicknames, each + separated by a space character and returns a list of information + about each nickname that it found. The returned list has each reply + separated by a space. + + Numeric Replies: + + RPL_USERHOST ERR_NEEDMOREPARAMS + + Examples: + + USERHOST Wiz Michael Marty p ;USERHOST request for information on + nicks "Wiz", "Michael", "Marty" and "p" + +5.8 Ison message + + Command: ISON + Parameters: {} + + The ISON command was implemented to provide a quick and efficient + means to get a response about whether a given nickname was currently + on IRC. ISON only takes one (1) parameter: a space-separated list of + nicks. For each nickname in the list that is present, the server + adds that to its reply string. Thus the reply string may return + empty (none of the given nicks are present), an exact copy of the + parameter string (all of them present) or as any other subset of the + set of nicks given in the parameter. The only limit on the number + of nicks that may be checked is that the combined length must not be + too large as to cause the server to chop it off so it fits in 512 + characters. + + ISON is only be processed by the server local to the client sending + the command and thus not passed onto other servers for further + processing. + + Numeric Replies: + + RPL_ISON ERR_NEEDMOREPARAMS + + Examples: + + ISON phone trillian WiZ jarlek Avalon Angel Monstah + ; Sample ISON request for 7 nicks. + + + +Oikarinen & Reed [Page 42] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + +6. REPLIES + + The following is a list of numeric replies which are generated in + response to the commands given above. Each numeric is given with its + number, name and reply string. + +6.1 Error Replies. + + 401 ERR_NOSUCHNICK + " :No such nick/channel" + + - Used to indicate the nickname parameter supplied to a + command is currently unused. + + 402 ERR_NOSUCHSERVER + " :No such server" + + - Used to indicate the server name given currently + doesn't exist. + + 403 ERR_NOSUCHCHANNEL + " :No such channel" + + - Used to indicate the given channel name is invalid. + + 404 ERR_CANNOTSENDTOCHAN + " :Cannot send to channel" + + - Sent to a user who is either (a) not on a channel + which is mode +n or (b) not a chanop (or mode +v) on + a channel which has mode +m set and is trying to send + a PRIVMSG message to that channel. + + 405 ERR_TOOMANYCHANNELS + " :You have joined too many \ + channels" + - Sent to a user when they have joined the maximum + number of allowed channels and they try to join + another channel. + + 406 ERR_WASNOSUCHNICK + " :There was no such nickname" + + - Returned by WHOWAS to indicate there is no history + information for that nickname. + + 407 ERR_TOOMANYTARGETS + " :Duplicate recipients. No message \ + + + +Oikarinen & Reed [Page 43] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + delivered" + + - Returned to a client which is attempting to send a + PRIVMSG/NOTICE using the user@host destination format + and for a user@host which has several occurrences. + + 409 ERR_NOORIGIN + ":No origin specified" + + - PING or PONG message missing the originator parameter + which is required since these commands must work + without valid prefixes. + + 411 ERR_NORECIPIENT + ":No recipient given ()" + 412 ERR_NOTEXTTOSEND + ":No text to send" + 413 ERR_NOTOPLEVEL + " :No toplevel domain specified" + 414 ERR_WILDTOPLEVEL + " :Wildcard in toplevel domain" + + - 412 - 414 are returned by PRIVMSG to indicate that + the message wasn't delivered for some reason. + ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that + are returned when an invalid use of + "PRIVMSG $" or "PRIVMSG #" is attempted. + + 421 ERR_UNKNOWNCOMMAND + " :Unknown command" + + - Returned to a registered client to indicate that the + command sent is unknown by the server. + + 422 ERR_NOMOTD + ":MOTD File is missing" + + - Server's MOTD file could not be opened by the server. + + 423 ERR_NOADMININFO + " :No administrative info available" + + - Returned by a server in response to an ADMIN message + when there is an error in finding the appropriate + information. + + 424 ERR_FILEERROR + ":File error doing on " + + + +Oikarinen & Reed [Page 44] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + - Generic error message used to report a failed file + operation during the processing of a message. + + 431 ERR_NONICKNAMEGIVEN + ":No nickname given" + + - Returned when a nickname parameter expected for a + command and isn't found. + + 432 ERR_ERRONEUSNICKNAME + " :Erroneus nickname" + + - Returned after receiving a NICK message which contains + characters which do not fall in the defined set. See + section x.x.x for details on valid nicknames. + + 433 ERR_NICKNAMEINUSE + " :Nickname is already in use" + + - Returned when a NICK message is processed that results + in an attempt to change to a currently existing + nickname. + + 436 ERR_NICKCOLLISION + " :Nickname collision KILL" + + - Returned by a server to a client when it detects a + nickname collision (registered of a NICK that + already exists by another server). + + 441 ERR_USERNOTINCHANNEL + " :They aren't on that channel" + + - Returned by the server to indicate that the target + user of the command is not on the given channel. + + 442 ERR_NOTONCHANNEL + " :You're not on that channel" + + - Returned by the server whenever a client tries to + perform a channel effecting command for which the + client isn't a member. + + 443 ERR_USERONCHANNEL + " :is already on channel" + + - Returned when a client tries to invite a user to a + channel they are already on. + + + +Oikarinen & Reed [Page 45] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 444 ERR_NOLOGIN + " :User not logged in" + + - Returned by the summon after a SUMMON command for a + user was unable to be performed since they were not + logged in. + + 445 ERR_SUMMONDISABLED + ":SUMMON has been disabled" + + - Returned as a response to the SUMMON command. Must be + returned by any server which does not implement it. + + 446 ERR_USERSDISABLED + ":USERS has been disabled" + + - Returned as a response to the USERS command. Must be + returned by any server which does not implement it. + + 451 ERR_NOTREGISTERED + ":You have not registered" + + - Returned by the server to indicate that the client + must be registered before the server will allow it + to be parsed in detail. + + 461 ERR_NEEDMOREPARAMS + " :Not enough parameters" + + - Returned by the server by numerous commands to + indicate to the client that it didn't supply enough + parameters. + + 462 ERR_ALREADYREGISTRED + ":You may not reregister" + + - Returned by the server to any link which tries to + change part of the registered details (such as + password or user details from second USER message). + + + 463 ERR_NOPERMFORHOST + ":Your host isn't among the privileged" + + - Returned to a client which attempts to register with + a server which does not been setup to allow + connections from the host the attempted connection + is tried. + + + +Oikarinen & Reed [Page 46] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 464 ERR_PASSWDMISMATCH + ":Password incorrect" + + - Returned to indicate a failed attempt at registering + a connection for which a password was required and + was either not given or incorrect. + + 465 ERR_YOUREBANNEDCREEP + ":You are banned from this server" + + - Returned after an attempt to connect and register + yourself with a server which has been setup to + explicitly deny connections to you. + + 467 ERR_KEYSET + " :Channel key already set" + 471 ERR_CHANNELISFULL + " :Cannot join channel (+l)" + 472 ERR_UNKNOWNMODE + " :is unknown mode char to me" + 473 ERR_INVITEONLYCHAN + " :Cannot join channel (+i)" + 474 ERR_BANNEDFROMCHAN + " :Cannot join channel (+b)" + 475 ERR_BADCHANNELKEY + " :Cannot join channel (+k)" + 481 ERR_NOPRIVILEGES + ":Permission Denied- You're not an IRC operator" + + - Any command requiring operator privileges to operate + must return this error to indicate the attempt was + unsuccessful. + + 482 ERR_CHANOPRIVSNEEDED + " :You're not channel operator" + + - Any command requiring 'chanop' privileges (such as + MODE messages) must return this error if the client + making the attempt is not a chanop on the specified + channel. + + 483 ERR_CANTKILLSERVER + ":You cant kill a server!" + + - Any attempts to use the KILL command on a server + are to be refused and this error returned directly + to the client. + + + + +Oikarinen & Reed [Page 47] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 491 ERR_NOOPERHOST + ":No O-lines for your host" + + - If a client sends an OPER message and the server has + not been configured to allow connections from the + client's host as an operator, this error must be + returned. + + 501 ERR_UMODEUNKNOWNFLAG + ":Unknown MODE flag" + + - Returned by the server to indicate that a MODE + message was sent with a nickname parameter and that + the a mode flag sent was not recognized. + + 502 ERR_USERSDONTMATCH + ":Cant change mode for other users" + + - Error sent to any user trying to view or change the + user mode for a user other than themselves. + +6.2 Command responses. + + 300 RPL_NONE + Dummy reply number. Not used. + + 302 RPL_USERHOST + ":[{}]" + + - Reply format used by USERHOST to list replies to + the query list. The reply string is composed as + follows: + + ::= ['*'] '=' <'+'|'-'> + + The '*' indicates whether the client has registered + as an Operator. The '-' or '+' characters represent + whether the client has set an AWAY message or not + respectively. + + 303 RPL_ISON + ":[ {}]" + + - Reply format used by ISON to list replies to the + query list. + + 301 RPL_AWAY + " :" + + + +Oikarinen & Reed [Page 48] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + 305 RPL_UNAWAY + ":You are no longer marked as being away" + 306 RPL_NOWAWAY + ":You have been marked as being away" + + - These replies are used with the AWAY command (if + allowed). RPL_AWAY is sent to any client sending a + PRIVMSG to a client which is away. RPL_AWAY is only + sent by the server to which the client is connected. + Replies RPL_UNAWAY and RPL_NOWAWAY are sent when the + client removes and sets an AWAY message. + + 311 RPL_WHOISUSER + " * :" + 312 RPL_WHOISSERVER + " :" + 313 RPL_WHOISOPERATOR + " :is an IRC operator" + 317 RPL_WHOISIDLE + " :seconds idle" + 318 RPL_ENDOFWHOIS + " :End of /WHOIS list" + 319 RPL_WHOISCHANNELS + " :{[@|+]}" + + - Replies 311 - 313, 317 - 319 are all replies + generated in response to a WHOIS message. Given that + there are enough parameters present, the answering + server must either formulate a reply out of the above + numerics (if the query nick is found) or return an + error reply. The '*' in RPL_WHOISUSER is there as + the literal character and not as a wild card. For + each reply set, only RPL_WHOISCHANNELS may appear + more than once (for long lists of channel names). + The '@' and '+' characters next to the channel name + indicate whether a client is a channel operator or + has been granted permission to speak on a moderated + channel. The RPL_ENDOFWHOIS reply is used to mark + the end of processing a WHOIS message. + + 314 RPL_WHOWASUSER + " * :" + 369 RPL_ENDOFWHOWAS + " :End of WHOWAS" + + - When replying to a WHOWAS message, a server must use + the replies RPL_WHOWASUSER, RPL_WHOISSERVER or + ERR_WASNOSUCHNICK for each nickname in the presented + + + +Oikarinen & Reed [Page 49] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + list. At the end of all reply batches, there must + be RPL_ENDOFWHOWAS (even if there was only one reply + and it was an error). + + 321 RPL_LISTSTART + "Channel :Users Name" + 322 RPL_LIST + " <# visible> :" + 323 RPL_LISTEND + ":End of /LIST" + + - Replies RPL_LISTSTART, RPL_LIST, RPL_LISTEND mark + the start, actual replies with data and end of the + server's response to a LIST command. If there are + no channels available to return, only the start + and end reply must be sent. + + 324 RPL_CHANNELMODEIS + " " + + 331 RPL_NOTOPIC + " :No topic is set" + 332 RPL_TOPIC + " :" + + - When sending a TOPIC message to determine the + channel topic, one of two replies is sent. If + the topic is set, RPL_TOPIC is sent back else + RPL_NOTOPIC. + + 341 RPL_INVITING + " " + + - Returned by the server to indicate that the + attempted INVITE message was successful and is + being passed onto the end client. + + 342 RPL_SUMMONING + " :Summoning user to IRC" + + - Returned by a server answering a SUMMON message to + indicate that it is summoning that user. + + 351 RPL_VERSION + ". :" + + - Reply by the server showing its version details. + The is the version of the software being + + + +Oikarinen & Reed [Page 50] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + used (including any patchlevel revisions) and the + is used to indicate if the server is + running in "debug mode". + + The "comments" field may contain any comments about + the version or further version details. + + 352 RPL_WHOREPLY + " \ + [*][@|+] : " + 315 RPL_ENDOFWHO + " :End of /WHO list" + + - The RPL_WHOREPLY and RPL_ENDOFWHO pair are used + to answer a WHO message. The RPL_WHOREPLY is only + sent if there is an appropriate match to the WHO + query. If there is a list of parameters supplied + with a WHO message, a RPL_ENDOFWHO must be sent + after processing each list item with being + the item. + + 353 RPL_NAMREPLY + " :[[@|+] [[@|+] [...]]]" + 366 RPL_ENDOFNAMES + " :End of /NAMES list" + + - To reply to a NAMES message, a reply pair consisting + of RPL_NAMREPLY and RPL_ENDOFNAMES is sent by the + server back to the client. If there is no channel + found as in the query, then only RPL_ENDOFNAMES is + returned. The exception to this is when a NAMES + message is sent with no parameters and all visible + channels and contents are sent back in a series of + RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark + the end. + + 364 RPL_LINKS + " : " + 365 RPL_ENDOFLINKS + " :End of /LINKS list" + + - In replying to the LINKS message, a server must send + replies back using the RPL_LINKS numeric and mark the + end of the list using an RPL_ENDOFLINKS reply. + + 367 RPL_BANLIST + " " + 368 RPL_ENDOFBANLIST + + + +Oikarinen & Reed [Page 51] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + " :End of channel ban list" + + - When listing the active 'bans' for a given channel, + a server is required to send the list back using the + RPL_BANLIST and RPL_ENDOFBANLIST messages. A separate + RPL_BANLIST is sent for each active banid. After the + banids have been listed (or if none present) a + RPL_ENDOFBANLIST must be sent. + + 371 RPL_INFO + ":" + 374 RPL_ENDOFINFO + ":End of /INFO list" + + - A server responding to an INFO message is required to + send all its 'info' in a series of RPL_INFO messages + with a RPL_ENDOFINFO reply to indicate the end of the + replies. + + 375 RPL_MOTDSTART + ":- Message of the day - " + 372 RPL_MOTD + ":- " + 376 RPL_ENDOFMOTD + ":End of /MOTD command" + + - When responding to the MOTD message and the MOTD file + is found, the file is displayed line by line, with + each line no longer than 80 characters, using + RPL_MOTD format replies. These should be surrounded + by a RPL_MOTDSTART (before the RPL_MOTDs) and an + RPL_ENDOFMOTD (after). + + 381 RPL_YOUREOPER + ":You are now an IRC operator" + + - RPL_YOUREOPER is sent back to a client which has + just successfully issued an OPER message and gained + operator status. + + 382 RPL_REHASHING + " :Rehashing" + + - If the REHASH option is used and an operator sends + a REHASH message, an RPL_REHASHING is sent back to + the operator. + + 391 RPL_TIME + + + +Oikarinen & Reed [Page 52] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + " :" + + - When replying to the TIME message, a server must send + the reply using the RPL_TIME format above. The string + showing the time need only contain the correct day and + time there. There is no further requirement for the + time string. + + 392 RPL_USERSSTART + ":UserID Terminal Host" + 393 RPL_USERS + ":%-8s %-9s %-8s" + 394 RPL_ENDOFUSERS + ":End of users" + 395 RPL_NOUSERS + ":Nobody logged in" + + - If the USERS message is handled by a server, the + replies RPL_USERSTART, RPL_USERS, RPL_ENDOFUSERS and + RPL_NOUSERS are used. RPL_USERSSTART must be sent + first, following by either a sequence of RPL_USERS + or a single RPL_NOUSER. Following this is + RPL_ENDOFUSERS. + + 200 RPL_TRACELINK + "Link \ + " + 201 RPL_TRACECONNECTING + "Try. " + 202 RPL_TRACEHANDSHAKE + "H.S. " + 203 RPL_TRACEUNKNOWN + "???? []" + 204 RPL_TRACEOPERATOR + "Oper " + 205 RPL_TRACEUSER + "User " + 206 RPL_TRACESERVER + "Serv S C \ + @" + 208 RPL_TRACENEWTYPE + " 0 " + 261 RPL_TRACELOG + "File " + + - The RPL_TRACE* are all returned by the server in + response to the TRACE message. How many are + returned is dependent on the the TRACE message and + + + +Oikarinen & Reed [Page 53] + +RFC 1459 Internet Relay Chat Protocol May 1993 + + + whether it was sent by an operator or not. There + is no predefined order for which occurs first. + Replies RPL_TRACEUNKNOWN, RPL_TRACECONNECTING and + RPL_TRACEHANDSHAKE are all used for connections + which have not been fully established and are either + unknown, still attempting to connect or in the + process of completing the 'server handshake'. + RPL_TRACELINK is sent by any server which handles + a TRACE message and has to pass it on to another + server. The list of RPL_TRACELINKs sent in + response to a TRACE command traversing the IRC + network should reflect the actual connectivity of + the servers themselves along that path. + RPL_TRACENEWTYPE is to be used for any connection + which does not fit in the other categories but is + being displayed anyway. + + 211 RPL_STATSLINKINFO + " \ + \ +