Compare commits
10 Commits
webview-3.
...
4813b67aaa
| Author | SHA1 | Date | |
|---|---|---|---|
| 4813b67aaa | |||
| b96b78fa96 | |||
| ab0d02f5f4 | |||
| b30a10e419 | |||
|
2dfb3ddff3
|
|||
| 7e63294b5e | |||
| c148987224 | |||
| 4550e15838 | |||
| cc867a0bb8 | |||
| 16a0ef9543 |
@@ -69,6 +69,7 @@ img_files = {
|
||||
{"SETTINGS/SYSTEM.INI", "common/settings/system.ini"},
|
||||
{"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"},
|
||||
{"SETTINGS/SYSTEM.ENV", "common/settings/system.env"},
|
||||
{"SETTINGS/USBDRV.DAT",VAR_DRVS .. "/usb/usbother/usbdrv.dat"},
|
||||
}
|
||||
|
||||
-- For russian build, add russian-only files.
|
||||
@@ -195,8 +196,8 @@ extra_files = {
|
||||
{"kolibrios/develop/utils/SPEDump", SRC_PROGS .. "/develop/SPEDump/SPEDump.kex"},
|
||||
{"kolibrios/emul/", "common/emul/*"},
|
||||
{"kolibrios/emul/dosbox/", "common/emul/DosBox/*"},
|
||||
{"kolibrios/emul/e80/readme.txt", SRC_PROGS .. "/emulator/e80/trunk/readme.txt"},
|
||||
{"kolibrios/emul/e80/keyboard.png", SRC_PROGS .. "/emulator/e80/trunk/keyboard.png"},
|
||||
{"kolibrios/emul/e80/readme.txt", SRC_PROGS .. "/emulator/e80/readme.txt"},
|
||||
{"kolibrios/emul/e80/keyboard.png", SRC_PROGS .. "/emulator/e80/keyboard.png"},
|
||||
{"kolibrios/emul/fceu/fceu", SRC_PROGS .. "/emulator/fceu/fceu"},
|
||||
{"kolibrios/emul/fceu/FCEU ReadMe.txt", SRC_PROGS .. "/emulator/fceu/FCEU ReadMe.txt"},
|
||||
{"kolibrios/emul/chip8/chip8", VAR_PROGS .. "/emulator/chip8/chip8"},
|
||||
@@ -284,7 +285,7 @@ extra_files = {
|
||||
{"kolibrios/netsurf/res/", "common/network/netsurf/res/*"},
|
||||
{"kolibrios/res/skins/", "../skins/authors.txt"},
|
||||
{"kolibrios/res/templates/", "common/templates/*"},
|
||||
{"kolibrios/res/templates/", SRC_PROGS .. "/emulator/e80/trunk/games/*"},
|
||||
{"kolibrios/res/templates/", SRC_PROGS .. "/emulator/e80/games/*"},
|
||||
{"kolibrios/res/templates/NES/", "common/templates/NES/*"},
|
||||
{"kolibrios/res/wallpapers/", "common/wallpapers/*"},
|
||||
{"kolibrios/res/system/", build_type .. "/settings/kolibri.lbl"},
|
||||
@@ -409,7 +410,7 @@ tup.append_table(img_files, {
|
||||
{"HACONFIG", VAR_PROGS .. "/other/ha/HACONFIG"},
|
||||
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
|
||||
{"APM", VAR_PROGS .. "/system/apm/apm"},
|
||||
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
|
||||
{"CALC", VAR_PROGS .. "/other/calc/calc"},
|
||||
{"CALCPLUS", VAR_PROGS .. "/other/calcplus/calcplus"},
|
||||
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
|
||||
{"COLRDIAL", VAR_PROGS .. "/system/colrdial/color_dialog"},
|
||||
@@ -428,14 +429,14 @@ tup.append_table(img_files, {
|
||||
{"KPACK", VAR_PROGS .. "/other/kpack/trunk/kpack"},
|
||||
{"LAUNCHER", VAR_PROGS .. "/system/launcher/trunk/launcher"},
|
||||
{"LOADDRV", VAR_PROGS .. "/system/loaddrv/loaddrv"},
|
||||
{"MAGNIFY", VAR_PROGS .. "/demos/magnify/trunk/magnify"},
|
||||
{"MAGNIFY", VAR_PROGS .. "/system/magnify/magnify"},
|
||||
{"MGB", VAR_PROGS .. "/testing/mgb/trunk/mgb"},
|
||||
{"MOUSEMUL", VAR_PROGS .. "/system/mousemul/trunk/mousemul"},
|
||||
{"MADMOUSE", VAR_PROGS .. "/other/madmouse/madmouse"},
|
||||
{"MYKEY", VAR_PROGS .. "/system/MyKey/trunk/MyKey"},
|
||||
{"PCIDEV", VAR_PROGS .. "/testing/pcidev/trunk/PCIDEV"},
|
||||
{"RDSAVE", VAR_PROGS .. "/system/rdsave/trunk/rdsave"},
|
||||
{"RTFREAD", VAR_PROGS .. "/other/rtfread/trunk/rtfread"},
|
||||
{"RTFREAD", VAR_PROGS .. "/other/rtfread/rtfread"},
|
||||
{"SEARCHAP", VAR_PROGS .. "/system/searchap/searchap"},
|
||||
{"SCRSHOOT", VAR_PROGS .. "/media/scrshoot/scrshoot"},
|
||||
{"SETUP", VAR_PROGS .. "/system/setup/trunk/setup"},
|
||||
@@ -523,10 +524,10 @@ tup.append_table(img_files, {
|
||||
{"LIB/RASTERWORKS.OBJ", VAR_PROGS .. "/develop/libraries/fontRasterWorks_unicode/RasterWorks.obj"},
|
||||
{"LIB/SORT.OBJ", VAR_PROGS .. "/develop/libraries/sorter/sort.obj"},
|
||||
{"LIB/TINYGL.OBJ", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/tinygl.obj"},
|
||||
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/trunk/animage"},
|
||||
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/animage"},
|
||||
{"MEDIA/FILLSCR", VAR_PROGS .. "/media/FillScr/fillscr"},
|
||||
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/trunk/kiv"},
|
||||
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/trunk/listplay"},
|
||||
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/kiv"},
|
||||
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/listplay"},
|
||||
{"MEDIA/MIDAMP", VAR_PROGS .. "/media/midamp/trunk/midamp"},
|
||||
{"MEDIA/MP3INFO", VAR_PROGS .. "/media/mp3info/mp3info"},
|
||||
{"MEDIA/PALITRA", VAR_PROGS .. "/media/palitra/trunk/palitra"},
|
||||
@@ -567,6 +568,7 @@ tup.append_table(img_files, {
|
||||
{"DRIVERS/OHCI.SYS", VAR_DRVS .. "/usb/ohci.sys"},
|
||||
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
|
||||
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
|
||||
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
|
||||
{"DRIVERS/USBSTOR.SYS", VAR_DRVS .. "/usb/usbstor.sys"},
|
||||
{"DRIVERS/RDC.SYS", VAR_DRVS .. "/video/rdc.sys"},
|
||||
{"DRIVERS/COMMOUSE.SYS", VAR_DRVS .. "/mouse/commouse.sys"},
|
||||
@@ -641,7 +643,7 @@ if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
}) end
|
||||
|
||||
if build_type == "ru_RU" then tup.append_table(extra_files, {
|
||||
{"kolibrios/utils/period", VAR_PROGS .. "/other/period/trunk/period"},
|
||||
{"kolibrios/utils/period", VAR_PROGS .. "/other/period/period"},
|
||||
{"kolibrios/games/Dungeons/Dungeons", VAR_PROGS .. "/games/Dungeons/Dungeons"},
|
||||
}) end
|
||||
|
||||
@@ -752,7 +754,7 @@ tup.append_table(img_files, {
|
||||
tup.append_table(extra_files, {
|
||||
-- {"kolibrios/3D/cubeline", VAR_PROGS .. "/demos/cubeline/trunk/cubeline"},
|
||||
{"kolibrios/3D/gears", VAR_PROGS .. "/demos/gears/gears"},
|
||||
{"kolibrios/emul/e80/e80", VAR_PROGS .. "/emulator/e80/trunk/e80"},
|
||||
{"kolibrios/emul/e80/e80", VAR_PROGS .. "/emulator/e80/e80"},
|
||||
{"kolibrios/emul/uarm/", VAR_CONTRIB .. "/other/uarm/uARM"},
|
||||
{"kolibrios/games/2048", VAR_PROGS .. "/games/2048/2048"},
|
||||
{"kolibrios/games/checkers", VAR_PROGS .. "/games/checkers/checkers"},
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
SERIAL_COMPATIBLE_API_VER = 0 ; increments in case of breaking changes
|
||||
|
||||
SERIAL_API_GET_VERSION = 0
|
||||
SERIAL_API_SRV_ADD_PORT = 1
|
||||
SERIAL_API_SRV_REMOVE_PORT = 2
|
||||
@@ -21,14 +23,18 @@ SERIAL_CONF_PARITY_ODD = 2
|
||||
SERIAL_CONF_PARITY_MARK = 3
|
||||
SERIAL_CONF_PARITY_SPACE = 4
|
||||
|
||||
SERIAL_CONF_STOP_BITS_1 = 0
|
||||
SERIAL_CONF_STOP_BITS_1_5 = 1
|
||||
SERIAL_CONF_STOP_BITS_2 = 2
|
||||
|
||||
SERIAL_CONF_FLOW_CTRL_NONE = 0
|
||||
|
||||
struct SP_DRIVER
|
||||
size dd ? ; size of this struct
|
||||
startup dd ? ; void __stdcall (*startup)(void *drv_data, const struct serial_conf *conf);
|
||||
shutdown dd ? ; void __stdcall (*shutdown)(void *drv_data);
|
||||
reconf dd ? ; void __stdcall (*reconf)(void *drv_data, const struct serial_conf *conf);
|
||||
tx dd ? ; void __stdcall (*tx)(void *drv_data);
|
||||
startup dd ? ; int __stdcall (*startup)(void *drv_data, const struct serial_conf *conf);
|
||||
shutdown dd ? ; int __stdcall (*shutdown)(void *drv_data);
|
||||
reconf dd ? ; int __stdcall (*reconf)(void *drv_data, const struct serial_conf *conf);
|
||||
tx dd ? ; int __stdcall (*tx)(void *drv_data);
|
||||
ends
|
||||
|
||||
struct SP_CONF
|
||||
@@ -123,6 +129,30 @@ proc serial_port_init
|
||||
ret
|
||||
endp
|
||||
|
||||
proc serial_port_get_version stdcall, version:dword
|
||||
locals
|
||||
.handler dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
endl
|
||||
mov eax, [serial_drv_handle]
|
||||
mov [.handler], eax
|
||||
mov dword [.io_code], SERIAL_API_GET_VERSION
|
||||
mov [.input], 0
|
||||
mov dword [.inp_size], 0
|
||||
mov eax, [version]
|
||||
mov [.output], eax
|
||||
mov dword [.out_size], 4
|
||||
|
||||
lea ecx, [.handler]
|
||||
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
proc serial_port_open stdcall uses ebx, port_id:dword, conf:dword, handle:dword
|
||||
locals
|
||||
.handler dd ?
|
||||
|
||||
@@ -9,8 +9,6 @@ __DEBUG_LEVEL__ = L_DBG
|
||||
|
||||
SERIAL_RING_BUF_SIZE = 32768
|
||||
|
||||
API_VERSION = 1
|
||||
|
||||
section '.flat' readable writable executable
|
||||
|
||||
include '../struct.inc'
|
||||
@@ -23,6 +21,9 @@ include 'common.inc'
|
||||
include 'ring_buf.inc'
|
||||
include 'uart16550.inc'
|
||||
|
||||
CURRENT_API = 0x0001
|
||||
API_VERSION = (SERIAL_COMPATIBLE_API_VER shl 16) + CURRENT_API
|
||||
|
||||
struct SERIAL_OBJ
|
||||
magic dd ?
|
||||
destroy dd ?
|
||||
@@ -45,7 +46,7 @@ struct SERIAL_PORT
|
||||
conf SP_CONF
|
||||
ends
|
||||
|
||||
proc START c, reason:dword
|
||||
proc START c, reason:dword, cmdline:dword
|
||||
cmp [reason], DRV_ENTRY
|
||||
jne .fail
|
||||
|
||||
@@ -347,15 +348,12 @@ proc sp_validate_conf
|
||||
mov eax, [ecx + SP_CONF.baudrate]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
mov al, [ecx + SP_CONF.word_size]
|
||||
cmp al, 8
|
||||
jne .fail ; TODO implement different word size
|
||||
mov al, [ecx + SP_CONF.stop_bits]
|
||||
cmp al, 1
|
||||
jne .fail ; TODO implement different stop bits count
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
ja .fail
|
||||
mov al, [ecx + SP_CONF.parity]
|
||||
cmp al, SERIAL_CONF_PARITY_NONE
|
||||
jne .fail ; TODO implement parity
|
||||
cmp al, SERIAL_CONF_PARITY_SPACE
|
||||
ja .fail
|
||||
mov al, [ecx + SP_CONF.flow_ctrl]
|
||||
cmp al, SERIAL_CONF_FLOW_CTRL_NONE
|
||||
jne .fail ; TODO implement flow control
|
||||
@@ -550,7 +548,6 @@ proc sp_setup
|
||||
mov eax, [edi + SERIAL_PORT.drv]
|
||||
mov ecx, [edi + SERIAL_PORT.drv_data]
|
||||
stdcall dword [eax + SP_DRIVER.reconf], ecx, esi
|
||||
xor eax, eax
|
||||
push eax
|
||||
test eax, eax
|
||||
jnz @f
|
||||
|
||||
@@ -350,10 +350,10 @@ endl
|
||||
; calc stop bits
|
||||
mov bx, LCR_STOP_1
|
||||
mov al, [esi + SP_CONF.stop_bits]
|
||||
cmp al, 1
|
||||
cmp al, SERIAL_CONF_STOP_BITS_1
|
||||
je .stop_bits_ok
|
||||
or bx, LCR_STOP_2
|
||||
cmp al, 2
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
jne .fail
|
||||
.stop_bits_ok:
|
||||
or [lcr], bx
|
||||
|
||||
@@ -1123,11 +1123,53 @@ proc uart_shutdown stdcall uses ebx, data:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
proc uart_reconf stdcall uses ebx esi, dev:dword, conf:dword
|
||||
mov ebx, [dev]
|
||||
proc uart_reconf stdcall uses esi, dev:dword, conf:dword
|
||||
locals
|
||||
ConfPacket rb 8
|
||||
endl
|
||||
mov esi, [conf]
|
||||
stdcall ftdi_set_baudrate, ebx, [esi + SP_CONF.baudrate]
|
||||
; TODO set word_size, parity, etc.
|
||||
xor edx, edx
|
||||
mov al, [esi + SP_CONF.word_size]
|
||||
cmp al, 7
|
||||
jb .invalid
|
||||
cmp al, 8
|
||||
ja .invalid
|
||||
mov dl, al
|
||||
; odd and even parities are different from serial api
|
||||
; serial api: even=1 odd=2
|
||||
; ft232x api: odd=1 even=2
|
||||
movzx eax, [esi + SP_CONF.parity]
|
||||
cmp al, SERIAL_CONF_PARITY_SPACE
|
||||
ja .invalid
|
||||
cmp al, SERIAL_CONF_PARITY_ODD
|
||||
ja .parity_ok
|
||||
cmp al, SERIAL_CONF_PARITY_EVEN
|
||||
jb .parity_ok
|
||||
; swap bits
|
||||
xor al, 0x3
|
||||
.parity_ok:
|
||||
shl eax, 8 ; parity offset
|
||||
or edx, eax
|
||||
movzx eax, [esi + SP_CONF.stop_bits]
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
ja .invalid
|
||||
shl eax, 11 ; stop bits offset
|
||||
or edx, eax
|
||||
mov word [ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) \
|
||||
+ (SIO_SET_DATA shl 8)
|
||||
mov word [ConfPacket + 2], dx
|
||||
mov word [ConfPacket + 4], 0
|
||||
mov word [ConfPacket + 6], 0
|
||||
lea edx, [ConfPacket]
|
||||
stdcall ftdi_blocking_ctrl_tranfser, [dev], edx
|
||||
test eax, eax
|
||||
jnz .exit
|
||||
stdcall ftdi_set_baudrate, [dev], [esi + SP_CONF.baudrate]
|
||||
ret
|
||||
|
||||
.invalid:
|
||||
or eax, -1
|
||||
.exit:
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -1204,17 +1246,10 @@ proc uart_rx stdcall uses ebx esi, data:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
proc ftdi_set_baudrate stdcall uses ebx esi edi, dev:dword, baud:dword
|
||||
proc ftdi_set_baudrate stdcall uses ebx, dev:dword, baud:dword
|
||||
locals
|
||||
ConfPacket rb 10
|
||||
EventData rd 3
|
||||
ConfPacket rb 8
|
||||
endl
|
||||
xor esi, esi
|
||||
xor ecx, ecx
|
||||
invoke CreateEvent
|
||||
mov [EventData], eax
|
||||
mov [EventData + 4], edx
|
||||
|
||||
mov ebx, [dev]
|
||||
cmp [ebx + ftdi_context.chipType], TYPE_2232H
|
||||
jl .c_clk
|
||||
@@ -1257,7 +1292,7 @@ endl
|
||||
jmp .calcend
|
||||
|
||||
.c_nextbaud2:
|
||||
cmp dword [edi + 8], C_CLK / (2 * 16)
|
||||
cmp dword [baud], C_CLK / (2 * 16)
|
||||
jl .c_nextbaud3
|
||||
mov edx, 2
|
||||
mov ecx, C_CLK / (2 * 16)
|
||||
@@ -1348,23 +1383,51 @@ endl
|
||||
mov word [ConfPacket + 4], cx
|
||||
mov word [ConfPacket + 6], 0
|
||||
|
||||
lea esi, [ConfPacket]
|
||||
lea ebx, [ConfPacket]
|
||||
stdcall ftdi_blocking_ctrl_tranfser, [dev], ebx
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
proc ftdi_blocking_ctrl_tranfser stdcall uses ebx esi edi, dev:dword, conf:dword
|
||||
; conf is a pointer to values: bmRequestType, bRequest, wValue, wIndex, wLength
|
||||
locals
|
||||
EventData rd 3
|
||||
endl
|
||||
xor esi, esi
|
||||
xor ecx, ecx
|
||||
invoke CreateEvent
|
||||
test eax, eax
|
||||
jz .exit
|
||||
mov [EventData], eax
|
||||
mov [EventData + 4], edx
|
||||
|
||||
mov eax, [dev]
|
||||
mov esi, [conf]
|
||||
lea edi, [EventData]
|
||||
invoke USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, 0,\
|
||||
invoke USBControlTransferAsync, [eax + ftdi_context.nullP], esi, 0,\
|
||||
0, control_callback, edi, 0
|
||||
test eax, eax
|
||||
jz .error
|
||||
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke WaitEvent
|
||||
|
||||
cmp [EventData + 8], 0 ; USB_STATUS_OK
|
||||
jne .error
|
||||
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke DestroyEvent
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
.error:
|
||||
.error:
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke DestroyEvent
|
||||
.exit:
|
||||
or eax, -1
|
||||
ret
|
||||
endp
|
||||
|
||||
4
drivers/usb/usbother/Tupfile.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
ROOT = "../../.."
|
||||
tup.rule("usbother.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
|
||||
tup.rule("usbdrv.asm", "fasm %f %o ", "%B.dat")
|
||||
214
drivers/usb/usbother/usbdrv.asm
Normal file
@@ -0,0 +1,214 @@
|
||||
;*****************************************************************************;
|
||||
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
|
||||
; Distributed under terms of the 3-Clause BSD License. ;
|
||||
;*****************************************************************************;
|
||||
; File of usb drivers
|
||||
; base = 0
|
||||
; offset | Size | Name | Description
|
||||
;=======================|=======|===============|=============================
|
||||
; base + 0 | 4 | ID_drv_table | offset to dev_ven drv array
|
||||
; base + 4 | 4 | Class_table | offset to class drv array
|
||||
;
|
||||
; n = 0 .. count driver with ID table
|
||||
; nt = count driver with ID table
|
||||
; ID_drv_table + 0*(n-1)| 4 | ID_TABLE | offset of base to table VID:PID
|
||||
; ID_drv_table + 4*(n-1)| 4 | DRV_NAME | offset of base to name the driver
|
||||
; ID_drv_table + 8*nt | 8 | __ZERO | terminaror of list
|
||||
|
||||
; k = 0 .. count driver on class code
|
||||
; kt = count driver on class code
|
||||
; Class_table + 0*(k-1) | 1 | LENGTH_CLASS | length of class code 1..3
|
||||
; Class_table + 1*(k-1) | 1 | USB_CLASS | main usb class code (M)
|
||||
; Class_table + 2*(k-1) | 1 | USB_SUBCLASS | USB subclass code or zero(V)
|
||||
; Class_table + 2*(k-1) | 1 | USB_PROTOCOL | USB protocol code or zero(V)
|
||||
; Class_table + 4*(k-1) | 4 | DRV_NAME | offset of base to name the driver
|
||||
; Class_table + 8*kt | 8 | __ZERO | terminaror of list
|
||||
|
||||
; i = 0 .. count VID:PID
|
||||
; it = count VID:PID
|
||||
; ID_TABLE + 0*(i-1) | 2 | VID | Vendor id
|
||||
; ID_TABLE + 2*(i-1) | 2 | PID | Product id
|
||||
; ID_TABLE + 4*it | 4 | __ZERO | terminaror of list
|
||||
|
||||
|
||||
macro INIT_USBDRV_FILE {
|
||||
local ..id_list, ..class_list
|
||||
|
||||
format binary as 'dat'
|
||||
use32
|
||||
org 0
|
||||
dd ..id_list
|
||||
dd ..class_list
|
||||
|
||||
|
||||
macro ID_DRV_TABLE \{
|
||||
dd 0, 0
|
||||
\}
|
||||
|
||||
macro CLASS_TABLE \{
|
||||
dd 0, 0
|
||||
\}
|
||||
macro ID_TABLE \{
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
\}
|
||||
postpone \{
|
||||
..id_list: ID_DRV_TABLE
|
||||
..class_list: CLASS_TABLE
|
||||
ID_TABLE
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
}
|
||||
|
||||
macro ADD_CLASS drv_name, class, subclass, protocol {
|
||||
|
||||
local ..length, ..class_code, ..drv_name
|
||||
|
||||
..length = 3
|
||||
|
||||
match =X, class \{
|
||||
err 'Class is mandatory argument'
|
||||
\}
|
||||
match =X, protocol \{
|
||||
..length = 2
|
||||
\}
|
||||
match =X, subclass \{
|
||||
..length = 1
|
||||
\}
|
||||
|
||||
..class_code = ..length or (class shl 8)
|
||||
|
||||
if ..length = 3
|
||||
..class_code = ..class_code or (protocol shl 24)
|
||||
end if
|
||||
if ..length = 2
|
||||
..class_code = ..class_code or (subclass shl 16)
|
||||
end if
|
||||
|
||||
|
||||
; add in list
|
||||
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
|
||||
macro CLASS_TABLE \{
|
||||
dd ..class_code, ..drv_name
|
||||
CLASS_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
macro ADD_ID drv_name, [device_id] {
|
||||
common
|
||||
local ..drv_name, ..id_table
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
..id_table:
|
||||
\}
|
||||
|
||||
reverse
|
||||
local vid_pid
|
||||
match VID:PID, device_id \{
|
||||
vid_pid = (PID shl 16) + VID
|
||||
\}
|
||||
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd vid_pid
|
||||
\}
|
||||
|
||||
common
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd 0
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
macro ID_DRV_TABLE \{
|
||||
dd ..id_table, ..drv_name
|
||||
ID_DRV_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
; ADD ID driver Linux
|
||||
macro ADD_IDL drv_name, [vendor_id, device_id] {
|
||||
common
|
||||
local ..drv_name, ..id_table
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
..id_table:
|
||||
\}
|
||||
|
||||
reverse
|
||||
local vid_pid
|
||||
vid_pid = (device_id shl 16) + vendor_id
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd vid_pid
|
||||
\}
|
||||
|
||||
common
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd 0
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
macro ID_DRV_TABLE \{
|
||||
dd ..id_table, ..drv_name
|
||||
ID_DRV_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
INIT_USBDRV_FILE
|
||||
|
||||
;ADD_CLASS 'usbcdc-ctrl' , 0x02, X , X
|
||||
;ADD_CLASS 'usbimage' , 0x06, 1 , 1
|
||||
;ADD_CLASS 'usbcdc-data' , 0x0A, X , X
|
||||
;ADD_CLASS 'ccid' , 0x0B, X , X
|
||||
;ADD_CLASS 'uvd' , 0x0E, X , X
|
||||
;ADD_CLASS 'uvd_2' , 0x0E, 0x02, X
|
||||
;ADD_CLASS 'usb_bluetooth' , 0xE0, 0x01, X
|
||||
;ADD_CLASS 'usb_wifi' , 0xE0, 0x02, X
|
||||
|
||||
|
||||
|
||||
ADD_ID 'usbftdi',\
|
||||
0x0403:0 ; Any FTDI device
|
||||
|
||||
;https://github.com/avrdudes/avrdude/blob/main/src/usbdevs.h#L51
|
||||
;ADD_ID 'usbasp',\
|
||||
; 0x16c0:0x05dc,\ ; VOTI Obdev's free shared PID
|
||||
; 0x03e8:0xc7b4,\ ; ATMEL (unofficial) USBasp
|
||||
; 0x16c0:0x092f ; VOTI NIBObee PID
|
||||
|
||||
;https://github.com/WCHSoftGroup/ch341par_linux/blob/main/driver/ch34x_pis.c
|
||||
;ADD_IDL 'ch341par',\
|
||||
; 0x1a86, 0x5512,\ ; ch341a default
|
||||
; 0x1a86, 0x55db,\ ; CH347T Mode1 SPI+IIC+UART
|
||||
; 0x1a86, 0x55dd,\ ; CH347T Mode3 JTAG+UART
|
||||
; 0x1a86, 0x55de,\ ; CH347F
|
||||
; 0x1a86, 0x55e7 ; CH339W
|
||||
|
||||
;https://github.com/openbsd/src/blob/master/sys/dev/usb/uchcom.c
|
||||
;https://github.com/WCHSoftGroup/ch341ser_linux/blob/main/driver/ch341.c
|
||||
;ADD_IDL 'ch341ser',\
|
||||
; 0x1a86, 0x7523,\ ; ch340 chip
|
||||
; 0x1a86, 0x7522,\ ; ch340k chip
|
||||
; 0x1a86, 0x5523,\ ; ch341 chip
|
||||
; 0x1a86, 0xe523,\ ; ch330 chip
|
||||
; 0x4348, 0x5523 ; ch340 custom chip
|
||||
|
||||
|
||||
|
||||
|
||||
523
drivers/usb/usbother/usbother.asm
Normal file
@@ -0,0 +1,523 @@
|
||||
;*****************************************************************************;
|
||||
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
|
||||
; Distributed under terms of the 3-Clause BSD License. ;
|
||||
; ;
|
||||
; usbother is a driver for loading USB drivers of a certain class and vendor. ;
|
||||
; ;
|
||||
; Version 0.1.1, 24 May 2025 ;
|
||||
; ;
|
||||
;*****************************************************************************;
|
||||
format PE native 0.05
|
||||
entry START
|
||||
; const
|
||||
|
||||
DRV_VERSION = 0x0101 ; 0.1.1
|
||||
|
||||
|
||||
; struct
|
||||
include '../../struct.inc'
|
||||
|
||||
; USB device descriptor
|
||||
struct DEVICE_DESCR
|
||||
bLength db ?
|
||||
bDescriptorType db ?
|
||||
bcdUSB dw ?
|
||||
bDeviceClass db ?
|
||||
bDeviceSubClass db ?
|
||||
bDeviceProtocol db ?
|
||||
bMaxPacketSize0 db ?
|
||||
idVendor dw ?
|
||||
idProduct dw ?
|
||||
bcdDevice dw ?
|
||||
iManufacturer db ?
|
||||
iProduct db ?
|
||||
iSerialNumber db ?
|
||||
bNumConfigurations db ?
|
||||
ends
|
||||
|
||||
struct INTERFACE_DESCR
|
||||
bLength db ?
|
||||
bDescriptorType db ?
|
||||
bInterfaceNumber db ?
|
||||
bAlternateSetting db ?
|
||||
bNumEndpoints db ?
|
||||
bInterfaceClass db ?
|
||||
bInterfaceSubClass db ?
|
||||
bInterfaceProtocol db ?
|
||||
iInterface db ?
|
||||
ends
|
||||
|
||||
|
||||
struct SRV
|
||||
srv_name rb 16 ;ASCIIZ string
|
||||
magic dd ? ;+0x10 ;'SRV '
|
||||
size dd ? ;+0x14 ;size of structure SRV
|
||||
fd dd ? ;+0x18 ;next SRV descriptor
|
||||
bk dd ? ;+0x1C ;prev SRV descriptor
|
||||
base dd ? ;+0x20 ;service base address
|
||||
entry dd ? ;+0x24 ;service START function
|
||||
srv_proc dd ? ;+0x28 ;user mode service handler
|
||||
srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
|
||||
ends
|
||||
|
||||
struct USBSRV
|
||||
srv SRV
|
||||
usb_func dd ?
|
||||
ends
|
||||
|
||||
struct USBFUNC
|
||||
strucsize dd ?
|
||||
add_device dd ?
|
||||
device_disconnect dd ?
|
||||
ends
|
||||
|
||||
USBDRV_TYPE_NOLOCK = 0 ; usb device not controlled (native driver
|
||||
; not found and IOCTL not opened device)
|
||||
USBDRV_TYPE_NATIVE = 1 ; native PE kernel driver for usb
|
||||
USBDRV_TYPE_IOCTL = 2 ; usb device is controlled by IOCTL service
|
||||
; (driver or userspace process/threads)
|
||||
USBDRV_IOCTL_BLOCKED = 4 ; blocked IOCTL interface, device disconnected
|
||||
|
||||
|
||||
|
||||
struct DRV_CONTEXT
|
||||
next dd ?
|
||||
prev dd ?
|
||||
drv_hand dd ?
|
||||
drv_pdata dd ?
|
||||
flags dd ?
|
||||
|
||||
config_descr dd ?
|
||||
interface_descr dd ?
|
||||
ep rd 64 ; 32 IN + 32 OUT endpointers pipe
|
||||
ends
|
||||
DRV_CONTEXT.ep0 fix (DRV_CONTEXT.ep + 0)
|
||||
|
||||
|
||||
section '.flat' code readable writable executable
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../peimport.inc'
|
||||
include '../../macros.inc'
|
||||
|
||||
|
||||
proc START c, state:dword, cmdline:dword
|
||||
|
||||
cmp [state], DRV_ENTRY
|
||||
jne .end
|
||||
; init
|
||||
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexInit
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexInit
|
||||
|
||||
; load drv_list
|
||||
stdcall load_drv_list, default_list
|
||||
test eax, eax
|
||||
jnz .end
|
||||
|
||||
; reg driver
|
||||
invoke RegUSBDriver, drv_name, service_proc, usb_functions
|
||||
ret
|
||||
.end:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
proc load_drv_list stdcall, .path:dword
|
||||
|
||||
push ebx
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexLock
|
||||
; load file
|
||||
invoke LoadFile, [.path]
|
||||
test eax, eax
|
||||
push eax
|
||||
jnz @f
|
||||
mov dword[esp], -1
|
||||
jmp .exit
|
||||
@@:
|
||||
cmp [drv_list], 0
|
||||
jz @f
|
||||
|
||||
invoke KernelFree, [drv_list]
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
mov [drv_list], eax
|
||||
mov dword[esp], 0
|
||||
.exit:
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc service_proc stdcall, .ioctl:dword
|
||||
|
||||
push esi
|
||||
or eax, -1
|
||||
mov esi, [.ioctl]
|
||||
|
||||
mov ecx, [esi + IOCTL.io_code]
|
||||
cmp ecx, .count_ioctl_codes
|
||||
jae .fail
|
||||
|
||||
jmp dword[.table_subfunction + ecx*4]
|
||||
|
||||
.table_subfunction:
|
||||
dd .get_version
|
||||
dd .update_list
|
||||
dd .get_array_dev
|
||||
dd .get_full_dev_data
|
||||
dd .open_dev
|
||||
dd .close_dev
|
||||
dd .control_transfer
|
||||
dd .bulk_transfer
|
||||
dd .interrupt_transfer
|
||||
;dd .control_transfer_async
|
||||
;dd .bulk_transfer_async
|
||||
;dd .interrupt_transfer_async
|
||||
.count_ioctl_codes = ($ - .table_subfunction)/4
|
||||
|
||||
.get_version:
|
||||
mov eax, [esi + IOCTL.output]
|
||||
cmp [esi + IOCTL.out_size], 4
|
||||
jne .fail
|
||||
|
||||
mov dword[eax], DRV_VERSION
|
||||
xor eax, eax
|
||||
jmp .exit
|
||||
|
||||
.update_list:
|
||||
; update list
|
||||
mov ecx, [esi + IOCTL.input]
|
||||
cmp [esi + IOCTL.inp_size], 0
|
||||
jnz @f
|
||||
|
||||
mov ecx, default_list
|
||||
@@:
|
||||
stdcall load_drv_list, ecx
|
||||
|
||||
.exit:
|
||||
pop esi
|
||||
ret
|
||||
|
||||
.get_array_dev:
|
||||
.get_full_dev_data:
|
||||
.open_dev:
|
||||
.close_dev:
|
||||
;
|
||||
.control_transfer:
|
||||
.bulk_transfer:
|
||||
.interrupt_transfer:
|
||||
|
||||
.fail:
|
||||
or eax, -1
|
||||
jmp .exit
|
||||
endp
|
||||
|
||||
|
||||
proc AddDevice stdcall, .config_pipe:dword, \
|
||||
.config_descr:dword,\
|
||||
.interface:dword
|
||||
|
||||
push esi edi
|
||||
mov eax, sizeof.DRV_CONTEXT
|
||||
invoke Kmalloc
|
||||
test eax, eax
|
||||
jz .err_init
|
||||
|
||||
mov esi, eax
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
mov edx, [usb_interface_list] ; next
|
||||
mov [esi + DRV_CONTEXT.next], edx
|
||||
mov [esi + DRV_CONTEXT.prev], usb_interface_list
|
||||
mov [usb_interface_list], esi
|
||||
mov [edx + DRV_CONTEXT.prev], esi
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
and [esi + DRV_CONTEXT.drv_hand], 0
|
||||
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NOLOCK
|
||||
|
||||
; lock mutex
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
; save device context data
|
||||
mov eax, [.config_pipe]
|
||||
mov [esi + DRV_CONTEXT.ep0], eax
|
||||
mov eax, [.config_descr]
|
||||
mov [esi + DRV_CONTEXT.config_descr], eax
|
||||
mov eax, [.interface]
|
||||
mov [esi + DRV_CONTEXT.interface_descr], eax
|
||||
|
||||
; get pointer to list
|
||||
mov edx, [drv_list]
|
||||
test edx, edx
|
||||
jz .err_exit
|
||||
|
||||
mov edi, edx
|
||||
add edi, [edx]
|
||||
|
||||
; get in ecx VID:PID code
|
||||
invoke USBGetParam, [.config_pipe], 0
|
||||
mov ecx, dword[eax + DEVICE_DESCR.idVendor]
|
||||
|
||||
.loop_id_drv:
|
||||
cmp dword[edi], 0
|
||||
jz .end_loop_id_drv
|
||||
|
||||
mov edx, [drv_list]
|
||||
add edx, [edi] ; ID_TABLE
|
||||
.loop_id:
|
||||
cmp dword[edx], 0
|
||||
jz .end_loop_id
|
||||
|
||||
; check id
|
||||
mov eax, ecx
|
||||
test word[edx + 2], 0xffff
|
||||
jne @f
|
||||
; driver for all devices of VID
|
||||
and eax, 0xffff
|
||||
@@:
|
||||
cmp [edx], eax ; check VID:PID
|
||||
je @f
|
||||
|
||||
add edx, 4
|
||||
jmp .loop_id
|
||||
@@: ; found
|
||||
call .load_drv
|
||||
jnz .exit
|
||||
|
||||
add edx, 4
|
||||
jmp .loop_id
|
||||
.end_loop_id:
|
||||
add edi, 8
|
||||
jmp .loop_id_drv
|
||||
|
||||
.end_loop_id_drv:
|
||||
|
||||
|
||||
push esi
|
||||
mov esi, str_1
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
|
||||
; get in ecx class code
|
||||
mov eax, [.interface]
|
||||
mov ecx, dword[eax + INTERFACE_DESCR.bInterfaceClass] ; 24-31bits
|
||||
|
||||
mov edi, [drv_list]
|
||||
add edi, [edi + 4]
|
||||
.loop_class:
|
||||
cmp dword[edi], 0
|
||||
jz .end_loop_class
|
||||
|
||||
; check class
|
||||
movzx eax, byte[edi] ; length
|
||||
and eax, 11b ; protect - max length = 3
|
||||
lea eax, [eax*8] ; 1 = 8; 2 = 16; 3 = 24
|
||||
xor edx, edx
|
||||
bts edx, eax
|
||||
dec edx ; bitmask
|
||||
|
||||
mov eax, [edi]
|
||||
shr eax, 8
|
||||
and eax, edx ; good class in list
|
||||
|
||||
and edx, ecx ; good class of device
|
||||
|
||||
cmp eax, edx
|
||||
je @f
|
||||
|
||||
add edi, 8
|
||||
jmp .loop_class
|
||||
@@: ; found
|
||||
call .load_drv
|
||||
jnz .exit
|
||||
|
||||
add edi, 8
|
||||
jmp .loop_class
|
||||
|
||||
; IN: edi - item list of driver
|
||||
; esi - DRV_CONTEXT
|
||||
; OUT: ZF - not found zF - found
|
||||
; function save drv handl in DRV_CONTEXT.drv_hand
|
||||
; and pdata in DRV_CONTEXT.drv_pdata
|
||||
.load_drv:
|
||||
push ecx edx
|
||||
; load driver
|
||||
push esi
|
||||
mov esi, str_2
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
mov ecx, [drv_list]
|
||||
add ecx, [edi + 4]
|
||||
|
||||
pusha
|
||||
mov esi, ecx
|
||||
invoke SysMsgBoardStr
|
||||
mov esi, str_newline
|
||||
invoke SysMsgBoardStr
|
||||
popa
|
||||
|
||||
invoke GetService, ecx
|
||||
test eax, eax
|
||||
jz @f
|
||||
|
||||
mov [esi + DRV_CONTEXT.drv_hand], eax
|
||||
; get function list
|
||||
mov ecx, [eax + USBSRV.usb_func]
|
||||
|
||||
; call AddDevice of driver
|
||||
stdcall [ecx + USBFUNC.add_device], [.config_pipe], \
|
||||
[.config_descr],\
|
||||
[.interface]
|
||||
mov [esi + DRV_CONTEXT.drv_pdata], eax
|
||||
test eax, eax
|
||||
jnz .load_drv.good
|
||||
|
||||
push esi
|
||||
mov esi, str_4
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
and [esi + DRV_CONTEXT.drv_hand], 0
|
||||
@@:
|
||||
pushf
|
||||
push esi
|
||||
mov esi, str_5
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
popf
|
||||
|
||||
pop edx ecx
|
||||
retn
|
||||
.load_drv.good:
|
||||
pushf
|
||||
push esi
|
||||
mov esi, str_3
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
popf
|
||||
|
||||
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
|
||||
pop edx ecx
|
||||
retn
|
||||
|
||||
|
||||
.err_exit:
|
||||
mov eax, esi
|
||||
invoke Kfree
|
||||
xor esi, esi
|
||||
.end_loop_class:
|
||||
.exit:
|
||||
; driver not found - Added libusb driver
|
||||
|
||||
; unlock mutex
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
mov eax, esi
|
||||
pop edi esi
|
||||
ret
|
||||
.err_init:
|
||||
xor eax, eax
|
||||
pop edi esi
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc DeviceDisconnected stdcall, .pdata:dword
|
||||
|
||||
mov eax, [.pdata]
|
||||
|
||||
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
|
||||
jz .no_native
|
||||
|
||||
cmp [eax + DRV_CONTEXT.drv_hand], 0
|
||||
jz .free
|
||||
|
||||
; call device disconnected
|
||||
mov ecx, [eax + DRV_CONTEXT.drv_hand]
|
||||
|
||||
mov edx, [ecx + USBSRV.usb_func]
|
||||
cmp dword[edx], USBFUNC.device_disconnect
|
||||
jbe .free ; TODO: check
|
||||
|
||||
stdcall [edx + USBFUNC.device_disconnect], [eax + DRV_CONTEXT.drv_pdata]
|
||||
.free:
|
||||
; clear list of DRV_CONTENT
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
mov eax, [.pdata]
|
||||
mov edx, [eax + DRV_CONTEXT.prev]
|
||||
mov ecx, [eax + DRV_CONTEXT.next]
|
||||
mov [edx + DRV_CONTEXT.next], ecx
|
||||
mov [ecx + DRV_CONTEXT.prev], edx
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
; free context
|
||||
mov eax, [.pdata]
|
||||
invoke Kfree
|
||||
ret
|
||||
.no_native:
|
||||
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_IOCTL
|
||||
jz .free
|
||||
|
||||
; set state for block user api and clear struct
|
||||
or [eax + DRV_CONTEXT.flags], USBDRV_IOCTL_BLOCKED
|
||||
xor ecx, ecx
|
||||
;mov [eax + DRV_CONTEXT.drv_hand], ecx
|
||||
;mov [eax + DRV_CONTEXT.drv_pdata], ecx
|
||||
mov [eax + DRV_CONTEXT.config_descr], ecx
|
||||
mov [eax + DRV_CONTEXT.interface_descr], ecx
|
||||
mov [eax + DRV_CONTEXT.ep0], ecx
|
||||
; TODO
|
||||
jmp .free
|
||||
endp
|
||||
|
||||
; data
|
||||
drv_list_lock MUTEX
|
||||
|
||||
drv_list dd ?
|
||||
|
||||
interface_list_lock MUTEX
|
||||
usb_interface_list:
|
||||
dd usb_interface_list
|
||||
dd usb_interface_list
|
||||
|
||||
|
||||
usb_functions:
|
||||
dd .end - usb_functions
|
||||
dd AddDevice
|
||||
dd DeviceDisconnected
|
||||
.end:
|
||||
|
||||
drv_name db 'usbother', 0
|
||||
|
||||
default_list: db '/sys/settings/usbdrv.dat', 0
|
||||
|
||||
str_1: db 'USBOTHER: Not found ID driver', 13, 10, 0
|
||||
str_2: db 'USBOTHER: Check found driver: ', 0, 13, 10, 0
|
||||
str_3: db 'USBOTHER: Device driver good', 13, 10, 0
|
||||
str_4: db 'USBOTHER: Device driver fail prob', 13, 10, 0
|
||||
str_5: db 'USBOTHER: Load device driver error', 13, 10, 0
|
||||
str_newline: db 13,10,0
|
||||
|
||||
data fixups
|
||||
end data
|
||||
@@ -13,12 +13,12 @@ rem
|
||||
set __value=
|
||||
set __res=
|
||||
shift
|
||||
|
||||
|
||||
:__allowed
|
||||
set __values=%1 %__values%
|
||||
shift
|
||||
if not "%1"=="" goto __allowed
|
||||
|
||||
|
||||
set /P __res=">
|
||||
:Check_Value
|
||||
for %%a in (%__values%) do if %%a==%__res% set __value=%__res%
|
||||
@@ -59,7 +59,7 @@ echo *
|
||||
fasm system\calendar\trunk\calendar.asm %BIN%\calendar
|
||||
fasm system\board\trunk\board.asm %BIN%\develop\board
|
||||
fasm system\commouse\trunk\commouse.asm %BIN%\commouse
|
||||
fasm system\cpu\trunk\cpu.asm %BIN%\cpu
|
||||
fasm system\cpu\trunk\cpu.asm %BIN%\cpu
|
||||
fasm system\cpuid\trunk\cpuid.asm %BIN%\cpuid
|
||||
fasm system\skincfg\trunk\skincfg.asm %BIN%\skincfg
|
||||
fasm system\docpack\trunk\docpack.asm %BIN%\docpack
|
||||
@@ -154,16 +154,16 @@ echo *
|
||||
echo Building other
|
||||
echo *
|
||||
rem fasm other\archer\trunk\@rcher.asm %BIN%\@rcher
|
||||
fasm other\calc\trunk\calc.asm %BIN%\calc
|
||||
fasm other\calc\calc.asm %BIN%\calc
|
||||
fasm other\mhc\trunk\mhc.asm %BIN%\mhc
|
||||
fasm other\period\trunk\period.asm %BIN%\period
|
||||
fasm other\rtfread\trunk\rtfread.asm %BIN%\rtfread
|
||||
fasm other\period\period.asm %BIN%\period
|
||||
fasm other\rtfread\rtfread.asm %BIN%\rtfread
|
||||
|
||||
echo *
|
||||
echo Building media
|
||||
echo *
|
||||
rem media\ac97snd\trunk\ac97snd.asm ac97snd
|
||||
fasm media\animage\trunk\animage.asm %BIN%\animage
|
||||
fasm media\animage\animage.asm %BIN%\animage
|
||||
fasm media\cdp\trunk\cdp.asm %BIN%\cdp
|
||||
fasm media\gifview\trunk\gifview.asm %BIN%\gifview
|
||||
fasm media\iconedit\trunk\iconedit.asm %BIN%\iconedit
|
||||
@@ -231,9 +231,9 @@ echo *
|
||||
echo Building depend application for fdd's nightbuild
|
||||
echo *
|
||||
echo __nightbuild fix yes >> config.inc
|
||||
fasm media\kiv\trunk\kiv.asm %BIN%\nightbuild\kiv
|
||||
fasm media\kiv\kiv.asm %BIN%\nightbuild\kiv
|
||||
fasm media\scrshoot\scrshoot.asm %BIN%\nightbuild\scrshoot
|
||||
fasm media\animage\trunk\animage.asm %BIN%\nightbuild\animage
|
||||
fasm media\animage\animage.asm %BIN%\nightbuild\animage
|
||||
fasm media\midamp\trunk\midamp.asm %BIN%\nightbuild\midamp
|
||||
fasm develop\heed\trunk\heed.asm %BIN%\nightbuild\heed
|
||||
fasm develop\tinypad\trunk\tinypad.asm %BIN%\nightbuild\tinypad
|
||||
@@ -242,27 +242,27 @@ fasm system\hdd_info\trunk\hdd_info.asm %BIN%\nightbuild\hdd_info
|
||||
fasm system\mgb\trunk\mgb.asm %BIN%\nightbuild\mgb
|
||||
fasm system\rdsave\trunk\rdsave.asm %BIN%\nightbuild\rdsave
|
||||
fasm other\kpack\trunk\kpack.asm %BIN%\nightbuild\kpack
|
||||
fasm other\rtfread\trunk\rtfread.asm %BIN%\nightbuild\rtfread
|
||||
fasm other\rtfread\rtfread.asm %BIN%\nightbuild\rtfread
|
||||
;restore
|
||||
echo __CPU_type fix %res% > config.inc
|
||||
erase lang.inc
|
||||
|
||||
echo *
|
||||
echo Finished building
|
||||
echo Finished building
|
||||
echo *
|
||||
|
||||
|
||||
kpack /nologo 2> nul
|
||||
if "%errorlevel%"=="9009" (
|
||||
echo *** NOTICE ***
|
||||
echo If you want to pack all applications you may
|
||||
echo If you want to pack all applications you may
|
||||
echo place "kpack" in accessible directory.
|
||||
echo You can download that tool from http://diamondz.land.ru/
|
||||
goto END
|
||||
)
|
||||
|
||||
echo Kpack KolibriOS apps?
|
||||
echo
|
||||
echo
|
||||
|
||||
set /P res=[y/n]?
|
||||
|
||||
@@ -273,7 +273,7 @@ echo Compressing system
|
||||
echo *
|
||||
kpack %BIN%\calendar
|
||||
kpack %BIN%\develop\board
|
||||
kpack %BIN%\cpu
|
||||
kpack %BIN%\cpu
|
||||
kpack %BIN%\cpuid
|
||||
kpack %BIN%\skincfg
|
||||
kpack %BIN%\docpack
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
add_include(tup.getvariantdir())
|
||||
|
||||
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||
tup.rule({"magnify.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "magnify")
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en_US >lang.inc
|
||||
@fasm magnify.asm magnify
|
||||
@kpack magnify
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru_RU >lang.inc
|
||||
@fasm magnify.asm magnify
|
||||
@kpack magnify
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,156 +0,0 @@
|
||||
;---------------------------------------------------------------------
|
||||
; MAGNIFY SCREEN v1.0
|
||||
;
|
||||
; Version for KolibriOS 2005-2011
|
||||
;
|
||||
; Version for Menuet to 2005
|
||||
;---------------------------------------------------------------------
|
||||
; last update: 08/18/2011
|
||||
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Checking for "rolled up" window
|
||||
;---------------------------------------------------------------------
|
||||
use32
|
||||
org 0x0
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 1 ; header version
|
||||
dd START ; program start
|
||||
dd I_END ; program image size
|
||||
dd 0x1000 ; required amount of memory
|
||||
dd 0x1000 ; esp
|
||||
dd 0, 0 ; no parameters, no path
|
||||
;---------------------------------------------------------------------
|
||||
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
|
||||
include '..\..\..\macros.inc'
|
||||
delay equ 20
|
||||
|
||||
magnify_width = 40
|
||||
magnify_height = 30
|
||||
;---------------------------------------------------------------------
|
||||
START: ; start of execution
|
||||
redraw:
|
||||
call draw_window
|
||||
still:
|
||||
call draw_magnify
|
||||
wtevent:
|
||||
mcall 23,delay ; wait here for event with timeout
|
||||
dec eax
|
||||
js still
|
||||
jz redraw
|
||||
dec eax
|
||||
jnz button
|
||||
; key in buffer
|
||||
mov al, 2
|
||||
mcall
|
||||
jmp wtevent
|
||||
;---------------------------------------------------------------------
|
||||
button:
|
||||
; we have only one button, close
|
||||
or eax, -1
|
||||
mcall
|
||||
;---------------------------------------------------------------------
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
;---------------------------------------------------------------------
|
||||
draw_window:
|
||||
mcall 12,1
|
||||
|
||||
mov al, 48 ; function 48 : graphics parameters
|
||||
mov bl, 4 ; subfunction 4 : get skin height
|
||||
mcall
|
||||
; DRAW WINDOW
|
||||
mov ebx, 100*65536 + 8*magnify_width + 8
|
||||
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
|
||||
mov edx, 0x34000000 ; color of work area RRGGBB
|
||||
mov edi, labelt ; header
|
||||
xor eax, eax ; function 0 : define and draw window
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
draw_magnify:
|
||||
mcall 9,procinfo,-1
|
||||
mov eax,[procinfo+70] ;status of window
|
||||
test eax,100b
|
||||
jne .end
|
||||
|
||||
mcall 14 ; get screen size
|
||||
movzx ecx, ax
|
||||
inc ecx
|
||||
mov [size_y], ecx
|
||||
shr eax, 16
|
||||
inc eax
|
||||
mov [size_x], eax
|
||||
|
||||
xor ebx, ebx
|
||||
mcall 37 ; get mouse coordinates
|
||||
mov ecx, eax
|
||||
shr ecx, 16 ; ecx = x
|
||||
movzx edx, ax ; edx = y
|
||||
inc ecx
|
||||
mov [m_xe], ecx
|
||||
inc edx
|
||||
mov [m_ye], edx
|
||||
sub ecx, magnify_width
|
||||
sub edx, magnify_height
|
||||
mov [m_x], ecx
|
||||
mov [m_y], edx
|
||||
.loop_y:
|
||||
.loop_x:
|
||||
xor eax, eax ; assume black color for invalid pixels
|
||||
test ecx, ecx
|
||||
js .nopix
|
||||
cmp ecx, [size_x]
|
||||
jge .nopix
|
||||
test edx, edx
|
||||
js .nopix
|
||||
cmp edx, [size_y]
|
||||
jge .nopix
|
||||
mov ebx, edx
|
||||
imul ebx, [size_x]
|
||||
add ebx, ecx
|
||||
mcall 35 ; read pixel
|
||||
.nopix:
|
||||
push ecx edx
|
||||
sub ecx, [m_x]
|
||||
sub edx, [m_y]
|
||||
mov ebx, ecx
|
||||
shl ebx, 3+16
|
||||
mov bl, 8
|
||||
mov ecx, edx
|
||||
shl ecx, 3+16
|
||||
mov cl, 8
|
||||
mov edx, eax
|
||||
mcall 13
|
||||
pop edx ecx
|
||||
inc ecx
|
||||
cmp ecx, [m_xe]
|
||||
jnz .loop_x
|
||||
mov ecx, [m_x]
|
||||
inc edx
|
||||
cmp edx, [m_ye]
|
||||
jnz .loop_y
|
||||
.end:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; DATA AREA
|
||||
;---------------------------------------------------------------------
|
||||
if lang eq ru_RU
|
||||
labelt:
|
||||
db 'Magnifier - <20>ªà ï «ã¯ ', 0
|
||||
else ; Default to en_US
|
||||
labelt:
|
||||
db 'Magnifier', 0
|
||||
end if
|
||||
|
||||
I_END:
|
||||
align 4
|
||||
m_x dd ?
|
||||
m_y dd ?
|
||||
m_xe dd ?
|
||||
m_ye dd ?
|
||||
size_x dd ?
|
||||
size_y dd ?
|
||||
;---------------------------------------------------------------------
|
||||
procinfo:
|
||||
rb 1024
|
||||
;---------------------------------------------------------------------
|
||||
@@ -1,6 +1,6 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2025. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; HTTP library for KolibriOS ;;
|
||||
@@ -2021,15 +2021,15 @@ str_head db 'HEAD ', 0
|
||||
str_post db 'POST ', 0
|
||||
|
||||
bits_must_escape:
|
||||
dd 0xffffffff ; 00-1F
|
||||
dd 1 shl 0 + 1 shl 2 + 1 shl 3 + 1 shl 5 + 1 shl 28 + 1 shl 30 ; "#%<>
|
||||
dd 1 shl 27 + 1 shl 28 + 1 shl 29 + 1 shl 30 ;[\]^
|
||||
dd 1 shl 0 + 1 shl 27 + 1 shl 28 + 1 shl 29 + 1 shl 31 ;`{|} DEL
|
||||
|
||||
dd 0xffffffff
|
||||
dd 0xffffffff
|
||||
dd 0xffffffff
|
||||
dd 0xffffffff
|
||||
; bit 31 <======== ========> bit 0 ; bit 0 ===> bit 31
|
||||
dd 0xffffffff ;00-1F
|
||||
dd 11111100_00000000_10011111_11111111b ; !"#$%&'()*+,/:;<=>?
|
||||
dd 01111000_00000000_00000000_00000001b ;@[\]^
|
||||
dd 10111000_00000000_00000000_00000001b ;`{|} DEL
|
||||
dd 0xffffffff ;80-9F
|
||||
dd 0xffffffff ;A0-BF
|
||||
dd 0xffffffff ;C0-DF
|
||||
dd 0xffffffff ;E0-FF
|
||||
|
||||
str_hex:
|
||||
db '0123456789ABCDEF'
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -1,5 +1,5 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
|
||||
tup.rule("PrMK.asm", FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "PrMK")
|
||||
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
@@ -1,5 +1,5 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_gcc.lua")
|
||||
INCLUDES = INCLUDES .. "-I" .. tup.getvariantdir()
|
||||
LDFLAGS = LDFLAGS .. " -T kolibri.ld"
|
||||
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
@@ -1,176 +1,177 @@
|
||||
; Text CodePage = cp1251
|
||||
|
||||
; <--- include all MeOS stuff --->
|
||||
|
||||
include "../../../../../macros.inc"
|
||||
|
||||
|
||||
; <--- start of MenuetOS application --->
|
||||
MEOS_APP_START
|
||||
|
||||
include "key_read.inc"
|
||||
|
||||
; <--- start of code --->
|
||||
CODE
|
||||
|
||||
mov eax,48 ; get system colors
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
|
||||
xor ecx, ecx
|
||||
inc ecx
|
||||
mcall 66,1 ; óñòàíîâêà ðåæèìà ââîäà ñêàíêîäîâ
|
||||
|
||||
|
||||
|
||||
redraw: ; redraw event handler
|
||||
call draw_window ; at first create and draw the window
|
||||
|
||||
wait_event: ; main cycle
|
||||
|
||||
mcall 10 ; îæèäàòü ñîáûòèå
|
||||
|
||||
; mcall 23, 2 ; âàðèàíò ïîñòîÿííûé îïðîñ
|
||||
; or eax, eax
|
||||
; jz key.1
|
||||
|
||||
dec eax ; if event = 1
|
||||
jz redraw ; jump to redraw handler
|
||||
dec eax ; else if event = 2
|
||||
jz key ; jump to key handler
|
||||
|
||||
|
||||
button: ; button event handler
|
||||
mov al, 17 ; get button identifier
|
||||
mcall
|
||||
|
||||
cmp ah, 1
|
||||
jne wait_event ; return if button id != 1
|
||||
|
||||
or eax, -1 ; exit application
|
||||
mcall
|
||||
|
||||
key: ; key event handler
|
||||
; get key code
|
||||
call load_keys
|
||||
; ïðåîáðàçîâàíèå
|
||||
.1:
|
||||
mov ah, 0xfe
|
||||
mov edx, txt_data.fe
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xfd
|
||||
mov edx, txt_data.fd
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xfb
|
||||
mov edx, txt_data.fb
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xf7
|
||||
mov edx, txt_data.f7
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xef
|
||||
mov edx, txt_data.ef
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xdf
|
||||
mov edx, txt_data.df
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xbf
|
||||
mov edx, txt_data.bf
|
||||
call load_ports
|
||||
|
||||
mov ah, 0x7f
|
||||
mov edx, txt_data.7f
|
||||
call load_ports
|
||||
|
||||
mov ah, 0x00
|
||||
mov edx, txt_data.00
|
||||
call load_ports
|
||||
|
||||
|
||||
|
||||
jmp redraw
|
||||
|
||||
draw_window:
|
||||
mov eax, 12 ; start drawing
|
||||
mov ebx, 1
|
||||
mcall
|
||||
|
||||
xor eax, eax ; create and draw the window
|
||||
mov ebx, 40*65536+560 ; (window_cx)*65536+(window_sx)
|
||||
mov ecx, 40*65536+240 ; (window_cy)*65536+(window_sy)
|
||||
mov edx, [sc.work] ; work area color
|
||||
or edx, 0x33000000 ; & window type 3
|
||||
mov edi, title ; window title
|
||||
int 0x40
|
||||
|
||||
mov ecx, [sc.work_text]
|
||||
or ecx, 0x80000000
|
||||
mov edx, txt_data
|
||||
mcall 4, 10*65536+40
|
||||
mov edx, txt_data.2s
|
||||
mcall 4, 10*65536+60
|
||||
mov edx, txt_data.3s
|
||||
mcall 4, 10*65536+80
|
||||
|
||||
|
||||
mov eax, 12 ; finish drawing
|
||||
mov ebx, 2
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
load_ports: ; âõîä ah - ñòàðøèé áàéò ïîðòà
|
||||
; edx - àäðåñ òåêñòà
|
||||
mov al, 0xFE
|
||||
call load_port_FE
|
||||
|
||||
rept 8
|
||||
{
|
||||
mov bl, '1'
|
||||
shl al,1
|
||||
jc @f
|
||||
mov bl, '0'
|
||||
@@:
|
||||
mov byte [edx], bl
|
||||
inc edx
|
||||
}
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
; <--- initialised data --->
|
||||
DATA
|
||||
|
||||
|
||||
title db 'Key ZX-Spectrum TEST',0
|
||||
|
||||
txt_data db '#FE: '
|
||||
.fe db '******** #FD: '
|
||||
.fd db '******** #FB: '
|
||||
.fb db '******** #F7: '
|
||||
.f7 db '******** ', 0
|
||||
.2s db '#EF: '
|
||||
.ef db '******** #DF: '
|
||||
.df db '******** #BF: '
|
||||
.bf db '******** #7F: '
|
||||
.7f db '******** ', 0
|
||||
.3s db '#00: '
|
||||
.00 db '******** ', 0
|
||||
|
||||
|
||||
; <--- uninitialised data --->
|
||||
UDATA
|
||||
sc system_colors
|
||||
|
||||
MEOS_APP_END
|
||||
; <--- end of MenuetOS application --->
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
; <--- include all MeOS stuff --->
|
||||
|
||||
include "../../../../macros.inc"
|
||||
|
||||
|
||||
; <--- start of MenuetOS application --->
|
||||
MEOS_APP_START
|
||||
|
||||
include "key_read.inc"
|
||||
|
||||
; <--- start of code --->
|
||||
CODE
|
||||
|
||||
mov eax,48 ; get system colors
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
|
||||
xor ecx, ecx
|
||||
inc ecx
|
||||
mcall 66,1 ; setting scancode input mode
|
||||
|
||||
|
||||
|
||||
redraw: ; redraw event handler
|
||||
call draw_window ; at first create and draw the window
|
||||
|
||||
wait_event: ; main cycle
|
||||
|
||||
mcall 10 ; expect an event
|
||||
|
||||
; mcall 23, 2 ; option constant poll
|
||||
; or eax, eax
|
||||
; jz key.1
|
||||
|
||||
dec eax ; if event = 1
|
||||
jz redraw ; jump to redraw handler
|
||||
dec eax ; else if event = 2
|
||||
jz key ; jump to key handler
|
||||
|
||||
|
||||
button: ; button event handler
|
||||
mov al, 17 ; get button identifier
|
||||
mcall
|
||||
|
||||
cmp ah, 1
|
||||
jne wait_event ; return if button id != 1
|
||||
|
||||
or eax, -1 ; exit application
|
||||
mcall
|
||||
|
||||
key: ; key event handler
|
||||
; get key code
|
||||
call load_keys
|
||||
; transformation
|
||||
.1:
|
||||
mov ah, 0xfe
|
||||
mov edx, txt_data.fe
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xfd
|
||||
mov edx, txt_data.fd
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xfb
|
||||
mov edx, txt_data.fb
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xf7
|
||||
mov edx, txt_data.f7
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xef
|
||||
mov edx, txt_data.ef
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xdf
|
||||
mov edx, txt_data.df
|
||||
call load_ports
|
||||
|
||||
mov ah, 0xbf
|
||||
mov edx, txt_data.bf
|
||||
call load_ports
|
||||
|
||||
mov ah, 0x7f
|
||||
mov edx, txt_data.7f
|
||||
call load_ports
|
||||
|
||||
mov ah, 0x00
|
||||
mov edx, txt_data.00
|
||||
call load_ports
|
||||
|
||||
|
||||
|
||||
jmp redraw
|
||||
|
||||
draw_window:
|
||||
mov eax, 12 ; start drawing
|
||||
mov ebx, 1
|
||||
mcall
|
||||
|
||||
xor eax, eax ; create and draw the window
|
||||
mov ebx, 40*65536+560 ; (window_cx)*65536+(window_sx)
|
||||
mov ecx, 40*65536+240 ; (window_cy)*65536+(window_sy)
|
||||
mov edx, [sc.work] ; work area color
|
||||
or edx, 0x33000000 ; & window type 3
|
||||
mov edi, title ; window title
|
||||
int 0x40
|
||||
|
||||
mov ecx, [sc.work_text]
|
||||
or ecx, 0x80000000
|
||||
mov edx, txt_data
|
||||
mcall 4, 10*65536+40
|
||||
mov edx, txt_data.2s
|
||||
mcall 4, 10*65536+60
|
||||
mov edx, txt_data.3s
|
||||
mcall 4, 10*65536+80
|
||||
|
||||
|
||||
mov eax, 12 ; finish drawing
|
||||
mov ebx, 2
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
|
||||
load_ports: ; input ah - port high byte
|
||||
; edx - text address
|
||||
mov al, 0xFE
|
||||
call load_port_FE
|
||||
|
||||
rept 8
|
||||
{
|
||||
mov bl, '1'
|
||||
shl al,1
|
||||
jc @f
|
||||
mov bl, '0'
|
||||
@@:
|
||||
mov byte [edx], bl
|
||||
inc edx
|
||||
}
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
; <--- initialised data --->
|
||||
DATA
|
||||
|
||||
|
||||
title db 'Key ZX-Spectrum TEST',0
|
||||
|
||||
txt_data db '#FE: '
|
||||
.fe db '******** #FD: '
|
||||
.fd db '******** #FB: '
|
||||
.fb db '******** #F7: '
|
||||
.f7 db '******** ', 0
|
||||
.2s db '#EF: '
|
||||
.ef db '******** #DF: '
|
||||
.df db '******** #BF: '
|
||||
.bf db '******** #7F: '
|
||||
.7f db '******** ', 0
|
||||
.3s db '#00: '
|
||||
.00 db '******** ', 0
|
||||
|
||||
|
||||
; <--- uninitialised data --->
|
||||
UDATA
|
||||
sc system_colors
|
||||
|
||||
MEOS_APP_END
|
||||
; <--- end of MenuetOS application --->
|
||||
@@ -1,376 +1,378 @@
|
||||
;*******************************************************
|
||||
;**************GRAPHICS EDITOR ANIMAGE *****************
|
||||
;*******************************************************
|
||||
; version: 1.52
|
||||
; last update: 23.11.2016
|
||||
; changes: Can save *.png files
|
||||
; autors: IgorA
|
||||
;--------------------------------------------------------
|
||||
; version: 1.51
|
||||
; last update: 23.03.2016
|
||||
; changes: Use library 'kmenu.obj', update GUI
|
||||
; autors: IgorA, Veliant, Leency
|
||||
;--------------------------------------------------------
|
||||
; version: 1.4
|
||||
; last update: 12.03.2016
|
||||
; changes: Use library 'libimg.obj'
|
||||
; autors: IgorA
|
||||
;--------------------------------------------------------
|
||||
; version: 1.3
|
||||
; last update: 05.10.2010
|
||||
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Fixed window flicker when redrawing,
|
||||
; Fixed memory leak for stack
|
||||
;--------------------------------------------------------
|
||||
; version: 1.2
|
||||
; last update: 30.09.2010
|
||||
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Program used function 68 instead 64 is now,
|
||||
; select path with OpenDialog
|
||||
;--------------------------------------------------------
|
||||
; version: 1.1
|
||||
; last update: 09.12.2006
|
||||
; autors:
|
||||
; programming by andrew_programmer
|
||||
; design by golus
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01'
|
||||
dd 1, START, IM_END, I_END
|
||||
dd stacktop, file_path, cur_dir_path
|
||||
|
||||
include '../../../config.inc' ;for nightbuild
|
||||
include '../../../macros.inc'
|
||||
include '../../../proc32.inc'
|
||||
include '../../../KOSfuncs.inc'
|
||||
include '../../../load_lib.mac'
|
||||
include '../../../dll.inc'
|
||||
include '../../../develop/libraries/libs-dev/libio/libio.inc'
|
||||
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
|
||||
;include '../../../debug.inc'
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
;---------------------------------------------------------
|
||||
; *** ª®áâ âë ¤«ï ¨â¥à䥩á ***
|
||||
; *** constants for interface ***
|
||||
|
||||
; ª®à४â¨à®¢ª¨ ᪨
|
||||
ci_offs_skin_w equ 5 ;ª®à४â¨à®¢ª è¨à¨ã à ¬ª¨ ᪨
|
||||
ci_offs_skin_h equ 24 ;ª®à४â¨à®¢ª ¢ëá®âã ᪨
|
||||
|
||||
; £« ¢®¥ ®ª®
|
||||
ci_wnd_min_siz_x equ 585 ;minimum size x
|
||||
ci_wnd_min_siz_y equ 400 ;minimum size y
|
||||
|
||||
; ¯ ¥«ì ¨áâà㬥⮢
|
||||
ci_panel_x_pos equ 0 ;ª®®à¤. x ¤«ï ¯ ¥«¨
|
||||
ci_panel_y_pos equ 20 ;ª®®à¤. y ¤«ï ¯ ¥«¨
|
||||
ci_panel_but_y1 equ ci_panel_y_pos +5 ;ª®®à¤. y ¤«ï 1-£® àï¤ ª®¯®ª
|
||||
ci_panel_but_y2 equ ci_panel_y_pos+30 ;ª®®à¤. y ¤«ï 2-£® àï¤ ª®¯®ª
|
||||
ci_palete_y_pos equ ci_panel_y_pos+51 ;ª®®à¤. y ¤«ï ¯ «¨âàë æ¢¥â®¢
|
||||
ci_panel_zoom_x equ 178 ;ª®®à¤. x ¤«ï ª®¯®ª ¯ ¥«¨ ¬ áèâ ¡
|
||||
|
||||
; ®ª® । ªâ®à
|
||||
ci_edit_wnd_x_pos equ 0 ;ª®®à¤. x ¤«ï ®ª । ªâ®à
|
||||
ci_edit_wnd_y_pos equ 71 ;ª®®à¤. y ¤«ï ®ª । ªâ®à
|
||||
ci_edit_wnd_border equ 3 ;à ¬ª ¢®ªà㣠®ª । ªâ®à
|
||||
|
||||
; áªà®««¨£¨
|
||||
ci_scroll_dim equ 22 ;à §¬¥àë áªà®««¨£®¢
|
||||
ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;¬¨¨¬ «ì ï ¯®§¨æ¨ï ¯®«§ãª
|
||||
;£®à¨§®â «ì®£® áªà®««¨£
|
||||
ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;¬¨¨¬ «ì ï ¯®§¨æ¨ï ¯®«§ãª
|
||||
;¢¥à⨪ «ì®£® áªà®««¨£
|
||||
;---------------------------------------------------------
|
||||
|
||||
include 'bmplib.inc'
|
||||
include 'dialog2.inc'
|
||||
include 'design.inc'
|
||||
include 'graphlib.inc'
|
||||
|
||||
include 'cursors.inc'
|
||||
include 'memory.inc'
|
||||
include 'load_from_parameters.inc'
|
||||
|
||||
START:
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors
|
||||
|
||||
load_libraries l_libs_start,end_l_libs
|
||||
|
||||
cmp eax,-1
|
||||
jz close
|
||||
|
||||
mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b
|
||||
;---------------------------------------------------------
|
||||
;-----------------------init data-------------------------
|
||||
;---------------------------------------------------------
|
||||
include 'init_data.inc'
|
||||
|
||||
;----------------------------------------------------------
|
||||
;--------get memory and draw window of program-------------
|
||||
;----------------------------------------------------------
|
||||
call GetMemory
|
||||
mov [Current_instrument],10 ;pencil
|
||||
call TakeButtonInstruments ;set startup instrument
|
||||
call cleare_work_arrea
|
||||
call load_icons
|
||||
call init_main_menu
|
||||
|
||||
;load cursors
|
||||
mov eax,CursorsID
|
||||
call load_cursors
|
||||
|
||||
;---------------------------------------------------------
|
||||
;---------check loading of file from parameters-----------
|
||||
;---------------------------------------------------------
|
||||
mov eax,file_path
|
||||
cmp [eax],byte 0
|
||||
jz @f
|
||||
call load_picture
|
||||
call MovePictureToWorkScreen
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
mov edi,filename_area
|
||||
mov esi,path4+5
|
||||
call copy_str_1
|
||||
|
||||
mov edi,file_path
|
||||
cmp [edi],byte 0
|
||||
jne @f
|
||||
mov esi,path4
|
||||
call copy_str_1
|
||||
@@:
|
||||
;OpenDialog initialisation
|
||||
stdcall [OpenDialog_Init], OpenDialog_data
|
||||
stdcall [ColorDialog_Init], ColorDialog_data
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
align 4
|
||||
red:
|
||||
call drawwin
|
||||
;----------------------------------------------------------
|
||||
;---------------------main loop----------------------------
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp eax,1
|
||||
je red
|
||||
|
||||
cmp eax,2
|
||||
je keys
|
||||
|
||||
cmp eax,3
|
||||
je buttons
|
||||
|
||||
cmp eax,6
|
||||
je mouse
|
||||
|
||||
jmp still
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
copy_str_1:
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
include 'events.inc'
|
||||
include 'events_of_window.inc'
|
||||
include 'events_of_keys.inc'
|
||||
include 'events_of_buttons.inc'
|
||||
include 'events_of_mouse.inc'
|
||||
include 'panel_engen.inc'
|
||||
include 'screen.inc'
|
||||
include 'menu_instruments.inc'
|
||||
include 'icons_instruments.inc'
|
||||
include 'icons.inc'
|
||||
include 'sprites.inc'
|
||||
include 'string.inc'
|
||||
include 'palette.inc'
|
||||
include 'files.inc'
|
||||
include 'time.inc'
|
||||
include 'menu.inc'
|
||||
;-----------------------------------------------------------
|
||||
;------------variables and data of program------------------
|
||||
;-----------------------------------------------------------
|
||||
;sound_havent_memory db 150,64,0
|
||||
|
||||
include 'lib_data.inc'
|
||||
include 'panel_data.inc'
|
||||
include 'brushes.inc'
|
||||
include 'spray.inc'
|
||||
include 'width_lines.inc'
|
||||
;----------------------------------------------------------
|
||||
;-------------------icon's picture-------------------------
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
panel_picture:
|
||||
file 'panel_buttons.png'
|
||||
.end:
|
||||
align 4
|
||||
panel_zoom:
|
||||
file 'panel_zoom.png'
|
||||
.end:
|
||||
;****************cursors******************
|
||||
brush_cursor:
|
||||
file 'cursors/brush.cur'
|
||||
flood_fill_cursor:
|
||||
file 'cursors/flood_fill.cur'
|
||||
lastik_cursor:
|
||||
file 'cursors/lastik.cur'
|
||||
other_cursor:
|
||||
file 'cursors/other.cur'
|
||||
pencil_cursor:
|
||||
file 'cursors/pencil.cur'
|
||||
pipette_cursor:
|
||||
file 'cursors/pipette.cur'
|
||||
spray_cursor:
|
||||
file 'cursors/spray.cur'
|
||||
zoom_cursor:
|
||||
file 'cursors/zoom.cur'
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
IM_END:
|
||||
;-----------------------------------------------------------
|
||||
;------------variables and data of program------------------
|
||||
;-----------------------------------------------------------
|
||||
time rd 1
|
||||
PosX rd 1 ;scroll x file position
|
||||
PosY rd 1 ;scroll y file position
|
||||
PointerToIcons rd 1
|
||||
ScreenPointer rd 1
|
||||
PointerToPicture rd 1
|
||||
PointerToCopyPicture rd 1
|
||||
PointerToCopyPicture2 rd 1
|
||||
PointerToEditBufer rd 1
|
||||
PointerToSpriteBufer rd 1
|
||||
PointerToPalette rd 1 ;㪠§ â¥«ì ¯¨«¨âàã (㦥 ¤«ï á®åà ¥¨ï ¢ *.bmp)
|
||||
Color rd 1
|
||||
SColor rd 1
|
||||
Number_Brush rd 1
|
||||
Brush_SizeX rd 1
|
||||
Brush_SizeY rd 1
|
||||
Current_instrument rd 1
|
||||
Last_instrument rd 1
|
||||
OldX rd 1
|
||||
OldY rd 1
|
||||
|
||||
MouseX rd 1
|
||||
MouseY rd 1
|
||||
MouseBut rd 1 ;ᮡëâ¨ï ®â ª®¯®ª ¬ëè¨
|
||||
Window_SizeX rd 1
|
||||
Window_SizeY rd 1
|
||||
Window_CordinatX rd 1
|
||||
Window_CordinatY rd 1
|
||||
Picture_SizeX rd 1
|
||||
Picture_SizeY rd 1
|
||||
ScreenX rd 1 ;ª®®à¤¨ â x ªãàá®à á ãç¥â®¬ ¬ áèâ ¡
|
||||
ScreenY rd 1 ;ª®®à¤¨ â y ªãàá®à á ãç¥â®¬ ¬ áèâ ¡
|
||||
WorkScreen_SizeX rd 1 ;è¨à¨ à ¡®ç¥£® íªà
|
||||
WorkScreen_SizeY rd 1 ;¢ëá®â à ¡®ç¥£® íªà
|
||||
MaxWorkScreen_SizeX rd 1
|
||||
MaxWorkScreen_SizeY rd 1
|
||||
k rd 1 ;¬ áèâ ¡
|
||||
|
||||
ReserveArray rd 1 ;㪠§ â¥«ì ¯ ¬ïâì ¨á¯®«ì§ã¥¬ãî ¯à¨ à¨á®¢ ¨¨ 䨣ãà
|
||||
;¤«ï á®åà ¥¨ï ãç á⪮¢ ä® ¯®¤ 䨣ãà ¬¨, â ª¦¥ ¤«ï § «¨¢ª¨
|
||||
CounterX rd 1 ;ç¨á«® ¯¨ªá¥«¥© ¨§®¡à ¦¥¨ï ¯® è¨à¨¥, ª®â®àë¥ ¯®¯ ¤ îâ
|
||||
;¢ íªà à ¡®ç¥© ®¡« áâ¨, á ãç¥â®¬ ⥪ã饣® ¬ áèâ ¡
|
||||
CounterY rd 1
|
||||
OffsetYPicture rd 1 ;ᤢ¨£ ¯® ®á¨ y ¢ ¡ãä¥à¥ ¨§®¡à ¦¥¨ï ¯à¨ à¨á®¢ ¨¨
|
||||
;á«¥¤ãî饩 «¨¨¨ ¨§®¡à ¦¥¨ï
|
||||
OffsetYWorkScreen rd 1 ;ᤢ¨£ ¯® ®á¨ y ¢ ¡ãä¥à¥ à ¡®ç¥© ®¡« á⨠¯à¨
|
||||
;à¨á®¢ ¨¨ á«¥¤ãî饩 «¨¨¨ ¯¨ªá¥«¥©. —¥¬ ¡®«ìè¥ ¬ áèâ ¡, ⥬ ¨¦¥
|
||||
;㦮 ®¯ã᪠âìáï ¯® à ¡®ç¥© ®¡« áâ¨.
|
||||
OffsetYBigPixel rd 1 ;ᤢ¨£ ¯® ®á¨ y ¤«ï à¨á®¢ ¨ï ¯¨ªá¥«¥© ¡®«ì讬
|
||||
;¬ áèâ ¡¥. <20>¨áã¥âáï 1-ï ¯®«®á ¯¨ªá¥«ï, ¯®â®¬ 㦮 ¯¥à¥©â¨ ¢¨§ ¨
|
||||
;¢«¥¢® ¤«ï à¨á®¢ ¨ï á«¥¤ãî饩 ¯®«®áë.
|
||||
|
||||
Icon_X rd 1
|
||||
Icon_Y rd 1
|
||||
counter rd 1
|
||||
counter2 rd 1
|
||||
number_panel rd 1
|
||||
number_menu rd 1
|
||||
|
||||
Scroll1CoordinatX rd 1 ;scroll x screen position
|
||||
Scroll1CoordinatY rd 1 ;scroll y screen position
|
||||
Scroll1MaxSizeX rd 1
|
||||
Scroll1MaxSizeY rd 1
|
||||
Scroll1SizeX rd 1 ;scroll polzunok size
|
||||
Scroll1FreeX rd 1
|
||||
|
||||
Scroll2CoordinatX rd 1
|
||||
Scroll2CoordinatY rd 1
|
||||
Scroll2MaxSizeX rd 1
|
||||
Scroll2MaxSizeY rd 1
|
||||
Scroll2SizeY rd 1
|
||||
Scroll2FreeY rd 1
|
||||
|
||||
x rd 1
|
||||
y rd 1
|
||||
|
||||
Radius rd 1
|
||||
Dx_ rd 1
|
||||
Dy_ rd 1
|
||||
line_width rd 1
|
||||
a_ellips rd 1
|
||||
b_ellips rd 1
|
||||
|
||||
used_OldX rd 1 ;for draw hard contour
|
||||
used_OldY rd 1
|
||||
paste_img_w rd 1 ;è¨à¨ ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥¨ï
|
||||
paste_img_h rd 1 ;¢ëá®â ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥¨ï
|
||||
crossing_old_x rd 1 ; ç «ì ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ¨ï
|
||||
crossing_old_y rd 1 ; ç «ì ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ¨ï
|
||||
rectangular_shade_x rd 1 ;ª®¥ç ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ¨ï
|
||||
rectangular_shade_y rd 1 ;ª®¥ç ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ¨ï
|
||||
crossing rd 1 ;0 - ¢ë¤¥«¥¨ï ¥â, 1 - ¨¤¥â ¯à®æ¥á ¢ë¤¥«¥¨ï,
|
||||
;2 - ¢ë¤¥«¥¨¥ § ¢¥à襮, 3 - ®¡« áâì ¢ë¤¥«¥¨ï ¯¥à¥¬¥é ¥âáï
|
||||
number_undo rd 1
|
||||
SpriteSizeX rd 1 ;???
|
||||
SpriteSizeY rd 1 ;???
|
||||
SpriteCoordinatX rd 1
|
||||
SpriteCoordinatY rd 1
|
||||
SpriteOldCoordinatX rd 1
|
||||
SpriteOldCoordinatY rd 1
|
||||
|
||||
CursorsID rd 10
|
||||
|
||||
Activate_instrument rb 1 ;¥á«¨ à ¢® 0 - â® ª®¯¨à®¢ ¨¥ ⥪ã饣® ¡ãä¥à
|
||||
;¤«ï ¥£® । ªâ¨à®¢ ¨ï, ¥á«¨ 1 - ⥪ã騩 ¡ãä¥à ¥ ª®¯¨àã¥âáï
|
||||
save_flag rb 1
|
||||
exit_from_work_arrea rb 1
|
||||
lastik_is_active rb 1
|
||||
instrument_used rb 1
|
||||
DrawSprite_flag rb 1
|
||||
Paste_flag rb 1
|
||||
;---------------------------------------------------------------------
|
||||
IncludeUGlobals
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
file_path rb 4096
|
||||
filename_area rb 256
|
||||
temp_dir_pach rb 4096
|
||||
library_path rb 4096
|
||||
cur_dir_path rb 4096
|
||||
procinfo: rb 1024
|
||||
align 4
|
||||
syscolors rb 192
|
||||
syscolors_end:
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
rb 4096
|
||||
stacktop:
|
||||
;---------------------------------------------------------------------
|
||||
I_END:
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
;*******************************************************
|
||||
;**************GRAPHICS EDITOR ANIMAGE *****************
|
||||
;*******************************************************
|
||||
; version: 1.52
|
||||
; last update: 23.11.2016
|
||||
; changes: Can save *.png files
|
||||
; author: IgorA
|
||||
;--------------------------------------------------------
|
||||
; version: 1.51
|
||||
; last update: 23.03.2016
|
||||
; changes: Use library 'kmenu.obj', update GUI
|
||||
; authors: IgorA, Veliant, Leency
|
||||
;--------------------------------------------------------
|
||||
; version: 1.4
|
||||
; last update: 12.03.2016
|
||||
; changes: Use library 'libimg.obj'
|
||||
; author: IgorA
|
||||
;--------------------------------------------------------
|
||||
; version: 1.3
|
||||
; last update: 05.10.2010
|
||||
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Fixed window flicker when redrawing,
|
||||
; Fixed memory leak for stack
|
||||
;--------------------------------------------------------
|
||||
; version: 1.2
|
||||
; last update: 30.09.2010
|
||||
; written by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Program used function 68 instead 64 is now,
|
||||
; select path with OpenDialog
|
||||
;--------------------------------------------------------
|
||||
; version: 1.1
|
||||
; last update: 09.12.2006
|
||||
; authors:
|
||||
; programming by andrew_programmer
|
||||
; design by golus
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01'
|
||||
dd 1, START, IM_END, I_END
|
||||
dd stacktop, file_path, cur_dir_path
|
||||
|
||||
include '../../config.inc' ;for nightbuild
|
||||
include '../../macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../dll.inc'
|
||||
include '../../develop/libraries/libs-dev/libio/libio.inc'
|
||||
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
|
||||
;include '../../debug.inc'
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
;---------------------------------------------------------
|
||||
; *** constants for interface ***
|
||||
|
||||
; skin adjustments
|
||||
ci_offs_skin_w equ 5 ;adjustment to the width of the skin frame
|
||||
ci_offs_skin_h equ 24 ;skin height adjustment
|
||||
|
||||
; main window
|
||||
ci_wnd_min_siz_x equ 585 ;minimum size x
|
||||
ci_wnd_min_siz_y equ 400 ;minimum size y
|
||||
|
||||
; toolbar
|
||||
ci_panel_x_pos equ 0 ;coord. x for panel
|
||||
ci_panel_y_pos equ 20 ;coord. y for panel
|
||||
ci_panel_but_y1 equ ci_panel_y_pos +5 ;y coordinate for 1st row of buttons
|
||||
ci_panel_but_y2 equ ci_panel_y_pos+30 ;y coordinate for 2nd row of buttons
|
||||
ci_palete_y_pos equ ci_panel_y_pos+51 ;y coordinate for color palette
|
||||
ci_panel_zoom_x equ 178 ;x coordinate for zoom bar buttons
|
||||
|
||||
; editor window
|
||||
ci_edit_wnd_x_pos equ 0 ;x coordinate for editor window
|
||||
ci_edit_wnd_y_pos equ 71 ;y coordinate for editor window
|
||||
ci_edit_wnd_border equ 3 ;frame around the editor window
|
||||
|
||||
; scrolling
|
||||
ci_scroll_dim equ 22 ;scroll sizes
|
||||
ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;x minimum slider position
|
||||
;horizontal scrolling
|
||||
ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;y minimum slider position
|
||||
;vertical scrolling
|
||||
;---------------------------------------------------------
|
||||
|
||||
include 'bmplib.inc'
|
||||
include 'dialog2.inc'
|
||||
include 'design.inc'
|
||||
include 'graphlib.inc'
|
||||
|
||||
include 'cursors.inc'
|
||||
include 'memory.inc'
|
||||
include 'load_from_parameters.inc'
|
||||
|
||||
START:
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors
|
||||
|
||||
load_libraries l_libs_start,end_l_libs
|
||||
|
||||
cmp eax,-1
|
||||
jz close
|
||||
|
||||
mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b
|
||||
;---------------------------------------------------------
|
||||
;-----------------------init data-------------------------
|
||||
;---------------------------------------------------------
|
||||
include 'init_data.inc'
|
||||
|
||||
;----------------------------------------------------------
|
||||
;--------get memory and draw window of program-------------
|
||||
;----------------------------------------------------------
|
||||
call GetMemory
|
||||
mov [Current_instrument],10 ;pencil
|
||||
call TakeButtonInstruments ;set startup instrument
|
||||
call cleare_work_arrea
|
||||
call load_icons
|
||||
call init_main_menu
|
||||
|
||||
;load cursors
|
||||
mov eax,CursorsID
|
||||
call load_cursors
|
||||
|
||||
;---------------------------------------------------------
|
||||
;---------check loading of file from parameters-----------
|
||||
;---------------------------------------------------------
|
||||
mov eax,file_path
|
||||
cmp [eax],byte 0
|
||||
jz @f
|
||||
call load_picture
|
||||
call MovePictureToWorkScreen
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
mov edi,filename_area
|
||||
mov esi,path4+5
|
||||
call copy_str_1
|
||||
|
||||
mov edi,file_path
|
||||
cmp [edi],byte 0
|
||||
jne @f
|
||||
mov esi,path4
|
||||
call copy_str_1
|
||||
@@:
|
||||
;OpenDialog initialisation
|
||||
stdcall [OpenDialog_Init], OpenDialog_data
|
||||
stdcall [ColorDialog_Init], ColorDialog_data
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
align 4
|
||||
red:
|
||||
call drawwin
|
||||
;----------------------------------------------------------
|
||||
;---------------------main loop----------------------------
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp eax,1
|
||||
je red
|
||||
|
||||
cmp eax,2
|
||||
je keys
|
||||
|
||||
cmp eax,3
|
||||
je buttons
|
||||
|
||||
cmp eax,6
|
||||
je mouse
|
||||
|
||||
jmp still
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
copy_str_1:
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
include 'events.inc'
|
||||
include 'events_of_window.inc'
|
||||
include 'events_of_keys.inc'
|
||||
include 'events_of_buttons.inc'
|
||||
include 'events_of_mouse.inc'
|
||||
include 'panel_engen.inc'
|
||||
include 'screen.inc'
|
||||
include 'menu_instruments.inc'
|
||||
include 'icons_instruments.inc'
|
||||
include 'icons.inc'
|
||||
include 'sprites.inc'
|
||||
include 'string.inc'
|
||||
include 'palette.inc'
|
||||
include 'files.inc'
|
||||
include 'time.inc'
|
||||
include 'menu.inc'
|
||||
;-----------------------------------------------------------
|
||||
;------------variables and data of program------------------
|
||||
;-----------------------------------------------------------
|
||||
;sound_havent_memory db 150,64,0
|
||||
|
||||
include 'lib_data.inc'
|
||||
include 'panel_data.inc'
|
||||
include 'brushes.inc'
|
||||
include 'spray.inc'
|
||||
include 'width_lines.inc'
|
||||
;----------------------------------------------------------
|
||||
;-------------------icon's picture-------------------------
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
panel_picture:
|
||||
file 'panel_buttons.png'
|
||||
.end:
|
||||
align 4
|
||||
panel_zoom:
|
||||
file 'panel_zoom.png'
|
||||
.end:
|
||||
;****************cursors******************
|
||||
brush_cursor:
|
||||
file 'cursors/brush.cur'
|
||||
flood_fill_cursor:
|
||||
file 'cursors/flood_fill.cur'
|
||||
lastik_cursor:
|
||||
file 'cursors/lastik.cur'
|
||||
other_cursor:
|
||||
file 'cursors/other.cur'
|
||||
pencil_cursor:
|
||||
file 'cursors/pencil.cur'
|
||||
pipette_cursor:
|
||||
file 'cursors/pipette.cur'
|
||||
spray_cursor:
|
||||
file 'cursors/spray.cur'
|
||||
zoom_cursor:
|
||||
file 'cursors/zoom.cur'
|
||||
;----------------------------------------------------------
|
||||
align 4
|
||||
IM_END:
|
||||
;-----------------------------------------------------------
|
||||
;------------variables and data of program------------------
|
||||
;-----------------------------------------------------------
|
||||
time rd 1
|
||||
PosX rd 1 ;scroll x file position
|
||||
PosY rd 1 ;scroll y file position
|
||||
PointerToIcons rd 1
|
||||
ScreenPointer rd 1
|
||||
PointerToPicture rd 1
|
||||
PointerToCopyPicture rd 1
|
||||
PointerToCopyPicture2 rd 1
|
||||
PointerToEditBufer rd 1
|
||||
PointerToSpriteBufer rd 1
|
||||
PointerToPalette rd 1 ;pointer to the file (needed for saving in *.bmp)
|
||||
Color rd 1
|
||||
SColor rd 1
|
||||
Number_Brush rd 1
|
||||
Brush_SizeX rd 1
|
||||
Brush_SizeY rd 1
|
||||
Current_instrument rd 1
|
||||
Last_instrument rd 1
|
||||
OldX rd 1
|
||||
OldY rd 1
|
||||
|
||||
MouseX rd 1
|
||||
MouseY rd 1
|
||||
MouseBut rd 1 ;mouse button events
|
||||
Window_SizeX rd 1
|
||||
Window_SizeY rd 1
|
||||
Window_CordinatX rd 1
|
||||
Window_CordinatY rd 1
|
||||
Picture_SizeX rd 1
|
||||
Picture_SizeY rd 1
|
||||
ScreenX rd 1 ;x coordinate of the cursor accounting for the scale
|
||||
ScreenY rd 1 ;y coordinate of the cursor accounting for the scale
|
||||
WorkScreen_SizeX rd 1 ;width of the working screen
|
||||
WorkScreen_SizeY rd 1 ;height of the working screen
|
||||
MaxWorkScreen_SizeX rd 1
|
||||
MaxWorkScreen_SizeY rd 1
|
||||
k rd 1 ;scale
|
||||
|
||||
ReserveArray rd 1 ;pointer to memory used when drawing figures
|
||||
;to save background areas under figures, as well as for filling
|
||||
CounterX rd 1 ;number of image pixels by width that fall
|
||||
;within the workspace screen, given the current zoom level
|
||||
CounterY rd 1
|
||||
OffsetYPicture rd 1 ;y-shift in image buffer when drawing
|
||||
;next line of image
|
||||
OffsetYWorkScreen rd 1 ;y-shift in the workspace buffer when
|
||||
;drawing the next line of pixels. The larger the scale, the lower
|
||||
;you need to go down the workspace.
|
||||
OffsetYBigPixel rd 1 ;shift along the y-axis to draw pixels on a large
|
||||
;scale. The 1st strip of the pixel is drawn, and then you need to move down and
|
||||
;left to draw the next strip.
|
||||
|
||||
Icon_X rd 1
|
||||
Icon_Y rd 1
|
||||
counter rd 1
|
||||
counter2 rd 1
|
||||
number_panel rd 1
|
||||
number_menu rd 1
|
||||
|
||||
Scroll1CoordinatX rd 1 ;scroll x screen position
|
||||
Scroll1CoordinatY rd 1 ;scroll y screen position
|
||||
Scroll1MaxSizeX rd 1
|
||||
Scroll1MaxSizeY rd 1
|
||||
Scroll1SizeX rd 1 ;scroll polzunok size
|
||||
Scroll1FreeX rd 1
|
||||
|
||||
Scroll2CoordinatX rd 1
|
||||
Scroll2CoordinatY rd 1
|
||||
Scroll2MaxSizeX rd 1
|
||||
Scroll2MaxSizeY rd 1
|
||||
Scroll2SizeY rd 1
|
||||
Scroll2FreeY rd 1
|
||||
|
||||
x rd 1
|
||||
y rd 1
|
||||
|
||||
Radius rd 1
|
||||
Dx_ rd 1
|
||||
Dy_ rd 1
|
||||
line_width rd 1
|
||||
a_ellips rd 1
|
||||
b_ellips rd 1
|
||||
|
||||
used_OldX rd 1 ;for draw hard contour
|
||||
used_OldY rd 1
|
||||
paste_img_w rd 1 ;width of the inserted image
|
||||
paste_img_h rd 1 ;height of the inserted image
|
||||
crossing_old_x rd 1 ;initial x-coord of copy area
|
||||
crossing_old_y rd 1 ;initial y-coord of copy area
|
||||
rectangular_shade_x rd 1 ;end x-coord of copy area
|
||||
rectangular_shade_y rd 1 ;end y-coord of copy area
|
||||
crossing rd 1 ;0 - no selection, 1 - selection in progress,
|
||||
;2 - selection complete, 3 - selection area moving
|
||||
number_undo rd 1
|
||||
SpriteSizeX rd 1 ;???
|
||||
SpriteSizeY rd 1 ;???
|
||||
SpriteCoordinatX rd 1
|
||||
SpriteCoordinatY rd 1
|
||||
SpriteOldCoordinatX rd 1
|
||||
SpriteOldCoordinatY rd 1
|
||||
|
||||
CursorsID rd 10
|
||||
|
||||
Activate_instrument rb 1 ;if equal to 0 - then copy the current buffer
|
||||
;for editing it, if 1 - the current buffer is not copied
|
||||
save_flag rb 1
|
||||
exit_from_work_arrea rb 1
|
||||
lastik_is_active rb 1
|
||||
instrument_used rb 1
|
||||
DrawSprite_flag rb 1
|
||||
Paste_flag rb 1
|
||||
;---------------------------------------------------------------------
|
||||
IncludeUGlobals
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
file_path rb 4096
|
||||
filename_area rb 256
|
||||
temp_dir_pach rb 4096
|
||||
library_path rb 4096
|
||||
cur_dir_path rb 4096
|
||||
procinfo: rb 1024
|
||||
align 4
|
||||
syscolors rb 192
|
||||
syscolors_end:
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
rb 4096
|
||||
stacktop:
|
||||
;---------------------------------------------------------------------
|
||||
I_END:
|
||||
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |