Charsets Checker 0.3.2
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 27s
Build system / Build (pull_request) Successful in 8m13s

- Renamed to Charsets Viewer/Charsets
- Fixed rolled-up bug
- Tweaked UI a little bit
- Renamed files in autobuild
- Moved charsets to programs/develop
- Added credits in charsets.asm
- Moved charsets dev history to separate file
This commit is contained in:
Taldariner
2025-03-07 10:01:27 +02:00
committed by Max Logaev
parent afeb89ea7f
commit 77d26709b0
6 changed files with 416 additions and 339 deletions

View File

@@ -468,7 +468,7 @@ tup.append_table(img_files, {
{"DEMOS/ZEROLINE", VAR_PROGS .. "/demos/zeroline/trunk/zeroline"}, {"DEMOS/ZEROLINE", VAR_PROGS .. "/demos/zeroline/trunk/zeroline"},
{"DEVELOP/BOARD", VAR_PROGS .. "/system/board/trunk/board"}, {"DEVELOP/BOARD", VAR_PROGS .. "/system/board/trunk/board"},
{"DEVELOP/CEDIT", SRC_PROGS .. "/develop/cedit/CEDIT"}, {"DEVELOP/CEDIT", SRC_PROGS .. "/develop/cedit/CEDIT"},
{"DEVELOP/CHARSETS", VAR_PROGS .. "/other/charset_checker/charchck"}, {"DEVELOP/CHARSETS", VAR_PROGS .. "/develop/charsets/charsets"},
{"DEVELOP/COBJ", VAR_PROGS .. "/develop/cObj/trunk/cObj"}, {"DEVELOP/COBJ", VAR_PROGS .. "/develop/cObj/trunk/cObj"},
{"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"}, {"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"},
{"DEVELOP/FASM", VAR_PROGS .. "/develop/fasm/1.73/fasm"}, {"DEVELOP/FASM", VAR_PROGS .. "/develop/fasm/1.73/fasm"},

View File

@@ -1,325 +1,325 @@
use32 use32
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01,start,i_end,e_end,e_end,0,0 dd 0x01,start,i_end,e_end,e_end,0,0
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../macros.inc' include '../../../macros.inc'
BUTTON_SIDE = 28 ; button are squares BUTTON_SIDE = 28 ; button are squares
BUTTON_SPACE = 34 ; space between cols and rows BUTTON_SPACE = 34 ; space between cols and rows
BUTTON_ID_SHIFT = 2 ; button_id = character + BUTTON_ID_SHIFT BUTTON_ID_SHIFT = 2 ; button_id = character + BUTTON_ID_SHIFT
TABLE_BEGIN_X = 2 TABLE_BEGIN_X = 2
TABLE_BEGIN_Y = 2 TABLE_BEGIN_Y = 2
PANEL_Y = BUTTON_SPACE*8+TABLE_BEGIN_Y+TABLE_BEGIN_Y PANEL_Y = BUTTON_SPACE*8+TABLE_BEGIN_Y+TABLE_BEGIN_Y
FOCUS_SQUARE_COLOR = 0x000080FF FOCUS_SQUARE_COLOR = 0x000080FF
SWITCHER_BLINK_COLOR = 0x00808080 SWITCHER_BLINK_COLOR = 0x00808080
FONT_SMALL = 0x01000000 FONT_SMALL = 0x01000000
FONT_BIG = 0x10000000 FONT_BIG = 0x10000000
start: start:
still: still:
mcall 10 mcall 10
dec eax dec eax
jz redraw jz redraw
dec eax dec eax
jz key jz key
button: button:
mcall 17 mcall 17
shr eax, 8 shr eax, 8
cmp eax, 1 cmp eax, 1
je quit je quit
cmp ax, 0xFFAA ; page switcher cmp ax, 0xFFAA ; page switcher
je .switch_page ; any button with a character je .switch_page ; any button with a character
cmp ax, 0xEEBB ; page switcher cmp ax, 0xEEBB ; page switcher
je .switch_font je .switch_font
.change_focus: .change_focus:
mov bl, [symbol_focused] mov bl, [symbol_focused]
mov [symbol_unfocused], bl mov [symbol_unfocused], bl
sub ax, BUTTON_ID_SHIFT ; get the corresponding character sub ax, BUTTON_ID_SHIFT ; get the corresponding character
mov [symbol_focused], al mov [symbol_focused], al
stdcall draw_table, 0 stdcall draw_table, 0
call draw_codes call draw_codes
jmp still jmp still
.switch_font: .switch_font:
cmp [font_type], FONT_SMALL cmp [font_type], FONT_SMALL
jne @f jne @f
mov [font_type], FONT_BIG mov [font_type], FONT_BIG
jmp redraw jmp redraw
@@: mov [font_type], FONT_SMALL @@: mov [font_type], FONT_SMALL
jmp redraw jmp redraw
.switch_page: .switch_page:
movzx bx, [symbol_start] movzx bx, [symbol_start]
add bx, BUTTON_ID_SHIFT add bx, BUTTON_ID_SHIFT
mov cx, 128 ; half of page mov cx, 128 ; half of page
mov edx, 0x80000000 mov edx, 0x80000000
mov dx, bx mov dx, bx
@@: mcall 8 @@: mcall 8
inc edx inc edx
dec cx dec cx
jnz @b jnz @b
@@: add [symbol_start], 128 ; change page @@: add [symbol_start], 128 ; change page
add [symbol_focused], 128 add [symbol_focused], 128
stdcall draw_table, 1 ; 1 means redraw the whole table stdcall draw_table, 1 ; 1 means redraw the whole table
call draw_codes call draw_codes
stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking
mcall 5, 10 mcall 5, 10
stdcall draw_page_switcher, 0 ; 0 means usual light color stdcall draw_page_switcher, 0 ; 0 means usual light color
jmp still jmp still
redraw: redraw:
mcall 9, proc_info, -1 mcall 9, proc_info, -1
mcall 12, 1 mcall 12, 1
mcall 48, 4 ; get skin height mcall 48, 4 ; get skin height
mov ecx, 200*0x10000+PANEL_Y+33 mov ecx, 200*0x10000+PANEL_Y+33
add ecx, eax add ecx, eax
mov ebx, 200*0x10000+BUTTON_SPACE*16+TABLE_BEGIN_X+TABLE_BEGIN_X+9 mov ebx, 200*0x10000+BUTTON_SPACE*16+TABLE_BEGIN_X+TABLE_BEGIN_X+9
mcall 0, , , 0x34AAAaaa, 0x80000000, window_title mcall 0, , , 0x34AAAaaa, 0x80000000, window_title
test [proc_info.wnd_state], 0x04 test [proc_info.wnd_state], 0x04
jnz @f jnz @f
stdcall draw_table, 1 stdcall draw_table, 1
call draw_codes call draw_codes
stdcall draw_page_switcher, 0 stdcall draw_page_switcher, 0
stdcall draw_font_switcher stdcall draw_font_switcher
@@: @@:
mcall 12, 2 mcall 12, 2
jmp still jmp still
key: key:
mcall 2 mcall 2
cmp ah, 0x09 ; TAB key cmp ah, 0x09 ; TAB key
je button.switch_page je button.switch_page
cmp ah, 0xB0 ; left cmp ah, 0xB0 ; left
jne @f jne @f
mov bl, [symbol_focused] mov bl, [symbol_focused]
mov [symbol_unfocused], bl mov [symbol_unfocused], bl
dec bl dec bl
and bl, 0x0f and bl, 0x0f
and [symbol_focused], 0xf0 and [symbol_focused], 0xf0
or [symbol_focused], bl or [symbol_focused], bl
stdcall draw_table, 0 stdcall draw_table, 0
call draw_codes call draw_codes
jmp still jmp still
@@: cmp ah, 0xB1 ; down @@: cmp ah, 0xB1 ; down
jne @f jne @f
mov bl, [symbol_focused] mov bl, [symbol_focused]
mov [symbol_unfocused], bl mov [symbol_unfocused], bl
add bl, 16 add bl, 16
and bl, 0x70 and bl, 0x70
and [symbol_focused], 0x8f and [symbol_focused], 0x8f
or [symbol_focused], bl or [symbol_focused], bl
stdcall draw_table, 0 stdcall draw_table, 0
call draw_codes call draw_codes
jmp still jmp still
@@: cmp ah, 0xB2 ; up @@: cmp ah, 0xB2 ; up
jne @f jne @f
mov bl, [symbol_focused] mov bl, [symbol_focused]
mov [symbol_unfocused], bl mov [symbol_unfocused], bl
sub bl, 16 sub bl, 16
and bl, 0x70 and bl, 0x70
and [symbol_focused], 0x8f and [symbol_focused], 0x8f
or [symbol_focused], bl or [symbol_focused], bl
stdcall draw_table, 0 stdcall draw_table, 0
call draw_codes call draw_codes
jmp still jmp still
@@: cmp ah, 0xB3 ; righ @@: cmp ah, 0xB3 ; righ
jne @f jne @f
mov bl, [symbol_focused] mov bl, [symbol_focused]
mov [symbol_unfocused], bl mov [symbol_unfocused], bl
inc bl inc bl
and bl, 0x0f and bl, 0x0f
and [symbol_focused], 0xf0 and [symbol_focused], 0xf0
or [symbol_focused], bl or [symbol_focused], bl
stdcall draw_table, 0 stdcall draw_table, 0
call draw_codes call draw_codes
jmp still jmp still
jne @f jne @f
@@: @@:
jmp still jmp still
proc draw_table _full_redraw proc draw_table _full_redraw
mov al, [symbol_start] mov al, [symbol_start]
mov [symbol_current], al mov [symbol_current], al
.next_button: .next_button:
xor edi, edi ; character focus flag xor edi, edi ; character focus flag
mov al, [symbol_current] mov al, [symbol_current]
cmp al, [symbol_focused] cmp al, [symbol_focused]
jne @f jne @f
inc edi inc edi
@@: cmp [_full_redraw], 1 @@: cmp [_full_redraw], 1
je .draw je .draw
cmp al, [symbol_focused] cmp al, [symbol_focused]
je .draw je .draw
cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus
je .draw je .draw
jmp .skip ; skip button if it isn't (un)focused jmp .skip ; skip button if it isn't (un)focused
.draw: .draw:
call draw_button call draw_button
.skip: .skip:
mov bl, [symbol_start] mov bl, [symbol_start]
add bl, 127 ; end of current page add bl, 127 ; end of current page
cmp [symbol_current], bl ; the last on page? cmp [symbol_current], bl ; the last on page?
jne @f jne @f
mov [button_x], TABLE_BEGIN_X mov [button_x], TABLE_BEGIN_X
mov [button_y], TABLE_BEGIN_Y mov [button_y], TABLE_BEGIN_Y
ret ret
@@: inc [symbol_current] @@: inc [symbol_current]
add [button_x], BUTTON_SPACE add [button_x], BUTTON_SPACE
cmp [button_x], BUTTON_SPACE*16+TABLE_BEGIN_X ; the last in row? cmp [button_x], BUTTON_SPACE*16+TABLE_BEGIN_X ; the last in row?
jne .next_button jne .next_button
add [button_y], BUTTON_SPACE ; next row add [button_y], BUTTON_SPACE ; next row
mov [button_x], TABLE_BEGIN_X mov [button_x], TABLE_BEGIN_X
jmp .next_button jmp .next_button
ret ret
endp endp
proc draw_button proc draw_button
mov edx, 0x80000000 mov edx, 0x80000000
mov dl, [symbol_current] mov dl, [symbol_current]
add edx, BUTTON_ID_SHIFT add edx, BUTTON_ID_SHIFT
mov esi, 0xFFFfff mov esi, 0xFFFfff
mcall 8, <[button_x],BUTTON_SIDE>, <[button_y],BUTTON_SIDE> mcall 8, <[button_x],BUTTON_SIDE>, <[button_y],BUTTON_SIDE>
and edx, 0x7FFFFFFF and edx, 0x7FFFFFFF
or edx, 0x20000000 or edx, 0x20000000
mcall mcall
test edi, edi ; is focused? test edi, edi ; is focused?
jz .symbol ; draw only character, not selection square jz .symbol ; draw only character, not selection square
.focus_frame: ; draw a blue square (selection), 8 segments .focus_frame: ; draw a blue square (selection), 8 segments
mov esi, [button_x] mov esi, [button_x]
mov edi, [button_y] mov edi, [button_y]
mov bx, si mov bx, si
shl ebx, 16 shl ebx, 16
mov bx, si mov bx, si
add bx, BUTTON_SIDE add bx, BUTTON_SIDE
mov cx, di mov cx, di
shl ecx, 16 shl ecx, 16
mov cx, di mov cx, di
mcall 38, , , FOCUS_SQUARE_COLOR mcall 38, , , FOCUS_SQUARE_COLOR
add ecx, 0x00010001 add ecx, 0x00010001
mcall mcall
add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2) add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
mcall mcall
add ecx, 0x00010001 add ecx, 0x00010001
mcall mcall
mov bx, si mov bx, si
shl ebx, 16 shl ebx, 16
mov bx, si mov bx, si
mov cx, di mov cx, di
shl ecx, 16 shl ecx, 16
mov cx, di mov cx, di
add ecx, 2*0x10000+(BUTTON_SIDE-2) add ecx, 2*0x10000+(BUTTON_SIDE-2)
mcall 38, , , mcall 38, , ,
add ebx, 0x00010001 add ebx, 0x00010001
mcall mcall
add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2) add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
mcall mcall
add ebx, 0x00010001 add ebx, 0x00010001
mcall mcall
.symbol: .symbol:
mov ebx, [button_x] mov ebx, [button_x]
add ebx, 9 add ebx, 9
shl ebx, 16 shl ebx, 16
add ebx, [button_y] add ebx, [button_y]
add ebx, 7 add ebx, 7
mov ecx, [font_type] mov ecx, [font_type]
mcall 4, , , symbol_current, 1 mcall 4, , , symbol_current, 1
ret ret
endp endp
proc draw_page_switcher _blinking proc draw_page_switcher _blinking
mcall 8, , , 0x8000FFAA mcall 8, , , 0x8000FFAA
mov esi, 0xCCCccc mov esi, 0xCCCccc
cmp [_blinking], 1 ; blinking? cmp [_blinking], 1 ; blinking?
jne @f jne @f
mov esi, SWITCHER_BLINK_COLOR mov esi, SWITCHER_BLINK_COLOR
@@: mcall , <2,98>, <PANEL_Y+1,23>, 0x0000FFAA @@: mcall , <2,98>, <PANEL_Y+1,23>, 0x0000FFAA
mov ecx, 0x81000000 mov ecx, 0x81000000
mov edx, string_000_127 mov edx, string_000_127
cmp [symbol_start], 0 ; first page? cmp [symbol_start], 0 ; first page?
je @f je @f
mov edx, string_128_255 ; ok, the second one mov edx, string_128_255 ; ok, the second one
@@: mcall 4, <10,PANEL_Y+6>, @@: mcall 4, <10,PANEL_Y+6>,
mcall , <278,PANEL_Y+6>, 0x81000000, string_ASCII_CODE mcall , <278,PANEL_Y+6>, 0x81000000, string_ASCII_CODE
ret ret
endp endp
proc draw_font_switcher proc draw_font_switcher
mcall 8, <120,136>, <PANEL_Y+1,23>, 0x0000EEBB mcall 8, <120,136>, <PANEL_Y+1,23>, 0x0000EEBB
mov edx, string_font_small mov edx, string_font_small
cmp [font_type], FONT_SMALL cmp [font_type], FONT_SMALL
je @f je @f
mov edx, string_font_big mov edx, string_font_big
@@: mcall 4, <130,PANEL_Y+6>,,,10 @@: mcall 4, <130,PANEL_Y+6>,,,10
ret ret
endp endp
proc draw_codes proc draw_codes
movzx ecx, [symbol_focused] movzx ecx, [symbol_focused]
mcall 47, 0x00030000, , <339,PANEL_Y+6>, 0x41000000, 0xAAAaaa mcall 47, 0x00030000, , <339,PANEL_Y+6>, 0x41000000, 0xAAAaaa
mcall , 0x00020100, , <508,PANEL_Y+6>, mcall , 0x00020100, , <508,PANEL_Y+6>,
ret ret
endp endp
quit: quit:
mcall -1 mcall -1
szZ window_title ,'ASCIIVju' szZ window_title ,'ASCIIVju'
szZ string_000_127 ,'000-127' szZ string_000_127 ,'000-127'
szZ string_128_255 ,'128-255' szZ string_128_255 ,'128-255'
szZ string_font_small ,'Font1 6x9 ' szZ string_font_small ,'Font1 6x9 '
szZ string_font_big ,'Font2 8x14' szZ string_font_big ,'Font2 8x14'
szZ string_ASCII_CODE ,'Code: Hex-Code:' szZ string_ASCII_CODE ,'Code: Hex-Code:'
button_x dd 2 button_x dd 2
button_y dd 2 button_y dd 2
font_type dd FONT_SMALL font_type dd FONT_SMALL
symbol_current db 0 symbol_current db 0
symbol_start db 0 symbol_start db 0
symbol_unfocused db 0 symbol_unfocused db 0
symbol_focused db 0 symbol_focused db 0
i_end: i_end:
proc_info process_information proc_info process_information
rb 0x400 ;stack rb 0x400 ;stack
e_end: e_end:

View File

@@ -0,0 +1,2 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("charsets.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "charsets")

View File

@@ -0,0 +1,33 @@
Development history
22.10.2024 - 0.1.0
- First version, display of charpages in all KOS charsets
23.10.2024 - 0.2.0
- Fixed UTF-8 display by Doczom
- Interface adaptation for skins
- Reduced redraw
- Refactored code
27.10.2024 - 0.2.5
- Fixed version in app header
- Tweaked UI colors
- Something else???
17.01.2025 - 0.3.0
- Added button to reset charpage to 00
- Functionality to pick and preview single character
- Functionality to input characters from keyboard
- Display of ASCII and SCAN codes of characters in dec and hex format
- Tweaked UI colors
17.01.2025 - 0.3.1
- Small UI fixes
- Code refactoring
- Reformatted sources, fixed indentation
and removed non-Unicode characters
07.03.2025 - 0.3.2
- Renamed to Charsets Viewer/Charsets
- Symbol highlight UI tweaks
- Fixed rolled up bug

View File

@@ -1,3 +1,8 @@
; SPDX-License-Identifier: GPL-2.0-only
; SPDX-FileCopyrightText: 2024-2025 KolibriOS Team
; ================================================================
format binary as "" format binary as ""
use32 use32
org 0 org 0
@@ -170,7 +175,8 @@ draw_window:
mcall 48, 3, window_colors, 40 mcall 48, 3, window_colors, 40
mcall , 4 mcall , 4
push eax add eax, 3
mov [win_head], eax
mov eax, 0 mov eax, 0
mov ebx, 100 * 65536 + 685 mov ebx, 100 * 65536 + 685
@@ -180,15 +186,24 @@ draw_window:
mov edi, title mov edi, title
mcall mcall
pop esi ; Don't draw rolled up or rolled down window
add esi, 495 mcall 9, proc_info, -1
mcall 67, -1, -1, -1, mov eax, [proc_info + 70]
mov [win_stat], eax
test [win_stat], 100b
jnz .draw_end
; Draw all app content
add [win_head], 492
call draw_base call draw_base
call draw_update call draw_update
call draw_toggle call draw_toggle
mcall 12, 2 .draw_end:
mov esi, [win_head]
mcall 67, -1, -1, -1,
mcall 12, 2
ret ret
@@ -399,9 +414,21 @@ draw_update:
mov al, 0x01 mov al, 0x01
mov ecx, eax mov ecx, eax
push ecx push ecx
mcall 13, 65536 * 34 + 384, , [window_colors.work_button]
add ecx, 65536 * 23 mov eax, 13
mov ebx, 65536 * 34 + 384
mov edx, [window_colors.work_button]
;skip lines aligned to table borders
cmp ecx, 65536 * 34 + 65536
jle .hl_next_hr
mcall mcall
.hl_next_hr:
add ecx, 65536 * 23
cmp ecx, 65536 * 417
jge .hl_end_hr
mcall
.hl_end_hr:
mov al, [char] mov al, [char]
and al, 0x0F and al, 0x0F
@@ -411,15 +438,28 @@ draw_update:
shl eax, 16 shl eax, 16
mov al, 0x01 mov al, 0x01
mov ebx, eax mov ebx, eax
mcall 13, , 65536 * 34 + 384, [window_colors.work_button]
add ebx, 65536 * 23 mov eax, 13
mov ecx, 65536 * 34 + 384
mov edx, [window_colors.work_button]
;skip lines aligned to table borders
cmp ebx, 65536 * 34 + 65536
jle .hl_next_vr
mcall mcall
.hl_next_vr:
add ebx, 65536 * 23
cmp ebx, 65536 * 417
jge .hl_end_vr
mcall
.hl_end_vr:
pop ecx pop ecx
add ecx, 23 add ecx, 23
sub ebx, 65535 * 23 sub ebx, 65535 * 23
mcall mcall
; redraw active symbol
shr ecx, 16 shr ecx, 16
mov bx, cx mov bx, cx
add ebx, 65536 * 8 + 5 add ebx, 65536 * 8 + 5
@@ -574,7 +614,7 @@ logic_utf16to8:
; ================================================================ ; ================================================================
title db "Charset Checker 0.3.1", 0 title db "Charsets Viewer 0.3.2", 0
lb_cp6x9 db "CP866 6x9 ", 0 lb_cp6x9 db "CP866 6x9 ", 0
lb_cp8x16 db "CP866 8x16 ", 0 lb_cp8x16 db "CP866 8x16 ", 0
@@ -609,7 +649,11 @@ char_ascii dw 0x0000, 0
char_scan dw 0x0000, 0 char_scan dw 0x0000, 0
char_utf dd 0x00000000, 0 char_utf dd 0x00000000, 0
window_colors system_colors win_stat rd 1
win_head rd 1
window_colors system_colors
proc_info process_information
; ================================================================ ; ================================================================

View File

@@ -1,2 +0,0 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("charset_checker.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "charchck")